PUT /v1/databases
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"
}'
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}")
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);
# 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"}
]'
{
"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"
}
Update a Database
Create or update a database with a full request body
PUT
/
v1
/
databases
PUT /v1/databases
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"
}'
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}")
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);
# 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"}
]'
{
"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"
}
Update a Database
Create a database or update it if it already exists, usingPUT /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
string
required
Name of the database. Must be unique within the parent service.
string
required
Fully qualified name of the parent DatabaseService.
string
Human-readable display name for the database.
string
Description of the database in Markdown format.
string
Data retention period in ISO 8601 duration format, for example
P365D.array
array
Fully qualified names of the domains to assign for governance purposes.
array
object
Custom property values defined by your organization’s metadata schema.
PUT /v1/databases
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"
}'
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}")
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);
# 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"}
]'
{
"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
string
Unique identifier for the database (UUID format).
string
Database name.
string
Fully qualified name in format
service.database.string
Updated description.
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 |
Was this page helpful?