> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a Database

> Create or update a database with a full request body

# Update a Database

Create a database or update it if it already exists, using `PUT /v1/databases` with the full request body. Send the complete definition, not just the fields you want to change. To change only some fields, use `PATCH` with a JSON Patch array and the `application/json-patch+json` content type, as shown in the PATCH examples below.

## Body Parameters

**name** `string` *required*

Name of the database. Must be unique within the parent service.

**service** `string` *required*

Fully qualified name of the parent DatabaseService.

**displayName** `string`

Human-readable display name for the database.

**description** `string`

Description of the database in Markdown format.

**retentionPeriod** `string`

Data retention period in ISO 8601 duration format, for example `P365D`.

**owners** `array`

Array of owner references (users or teams) to assign to the database.

**properties**

**id** `string`

UUID of the owner entity.

**type** `string`

Type of owner entity, for example `user`, `team`.

**name** `string`

Name of the owner entity.

**domains** `array`

Fully qualified names of the domains to assign for governance purposes.

**tags** `array`

Array of classification tags to apply to the database.

**properties**

**tagFQN** `string` *required*

Fully qualified name of the tag.

**labelType** `string`

Type of label, for example `Manual`, `Derived`, `Propagated`.

**state** `string`

State of the tag, for example `Suggested`, `Confirmed`.

**extension** `object`

Custom property values defined by your organization's metadata schema.

```bash PUT /v1/databases theme={null}
curl -X PUT "{base_url}/api/v1/databases" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "default",
    "displayName": "Default Database",
    "service": "mysql_sample",
    "description": "Default MySQL database for sample data",
    "retentionPeriod": "P365D"
  }'
```

```python PATCH /v1/databases/{id} theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import Databases

configure(
    host="https://your-company.open-metadata.org/api",
    jwt_token="your-jwt-token"
)

# Retrieve, modify, and update
database = Databases.retrieve("550e8400-e29b-41d4-a716-446655440000")
database.description = "Updated analytics data warehouse"
database.retentionPeriod = "P730D"
updated = Databases.update(database)

print(f"Updated to version {updated.version.root}")
```

```java PATCH /v1/databases/{id} theme={null}
import org.openmetadata.schema.entity.data.Database;

// client is an initialized OpenMetadataClient.

// Retrieve, modify, and update
Database database = client.databases().get("550e8400-e29b-41d4-a716-446655440000");
database.setDescription("Updated analytics data warehouse");
Database updated = client.databases().update("550e8400-e29b-41d4-a716-446655440000", database);
```

```bash PATCH /v1/databases/{id} theme={null}
# Update by ID
curl -X PATCH "{base_url}/api/v1/databases/1d08c2c6-cea7-4adf-9043-0f6a6aaf9721" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json-patch+json" \
  -d '[
    {"op": "replace", "path": "/description", "value": "Updated default MySQL database"},
    {"op": "replace", "path": "/retentionPeriod", "value": "P730D"}
  ]'

# Update by name
curl -X PATCH "{base_url}/api/v1/databases/name/mysql_sample.default" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json-patch+json" \
  -d '[
    {"op": "replace", "path": "/description", "value": "Updated default MySQL database"}
  ]'
```

```json Response theme={null}
{
  "id": "1d08c2c6-cea7-4adf-9043-0f6a6aaf9721",
  "name": "default",
  "fullyQualifiedName": "mysql_sample.default",
  "description": "Updated default MySQL database",
  "tags": [],
  "version": 0.2,
  "updatedAt": 1769982700000,
  "updatedBy": "admin",
  "href": "http://localhost:8585/api/v1/databases/1d08c2c6-cea7-4adf-9043-0f6a6aaf9721",
  "owners": [],
  "service": {
    "id": "4724c3cb-d4b8-4ac0-aa55-e8bb66f01ac3",
    "type": "databaseService",
    "name": "mysql_sample",
    "fullyQualifiedName": "mysql_sample",
    "displayName": "mysql_sample",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/services/databaseServices/4724c3cb-d4b8-4ac0-aa55-e8bb66f01ac3"
  },
  "serviceType": "Mysql",
  "retentionPeriod": "P730D",
  "default": false,
  "deleted": false,
  "domains": [],
  "entityStatus": "Unprocessed"
}
```

***

## Returns

Returns the updated database object with the new version number.

## Response

**id** `string`

Unique identifier for the database (UUID format).

**name** `string`

Database name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.database`.

**description** `string`

Updated description.

**version** `number`

Incremented version number.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `400` | `BAD_REQUEST` | Invalid or malformed request body |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to update this database |
| `409` | `CONFLICT` | Concurrent modification detected |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.