PATCH /v1/databases/{id}
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}")
import static org.openmetadata.sdk.fluent.Databases.*;
// Retrieve, modify, and update
Database database = Databases.retrieve("550e8400-e29b-41d4-a716-446655440000");
database.setDescription("Updated analytics data warehouse");
Database updated = Databases.update(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
Update database properties using JSON Patch
PATCH
/
v1
/
databases
/
{id}
PATCH /v1/databases/{id}
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}")
import static org.openmetadata.sdk.fluent.Databases.*;
// Retrieve, modify, and update
Database database = Databases.retrieve("550e8400-e29b-41d4-a716-446655440000");
database.setDescription("Updated analytics data warehouse");
Database updated = Databases.update(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
Update a database’s properties using JSON Merge Patch. You can update by ID or by fully qualified name.Update by ID
string
required
UUID of the database to update.
Update by Name
UsePATCH /v1/databases/name/{fqn} to update by fully qualified name.
string
required
Fully qualified name of the database (e.g.,
snowflake_prod.analytics).Body Parameters
Send a JSON object with the fields to update. Only provided fields are changed.string
Updated description in Markdown format.
string
Updated display name.
array
array
string
Updated retention period in ISO 8601 duration format.
string
Updated domain FQN.
object
Updated custom property values.
PATCH /v1/databases/{id}
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}")
import static org.openmetadata.sdk.fluent.Databases.*;
// Retrieve, modify, and update
Database database = Databases.retrieve("550e8400-e29b-41d4-a716-446655440000");
database.setDescription("Updated analytics data warehouse");
Database updated = Databases.update(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 JSON patch or malformed request |
401 | UNAUTHORIZED | Invalid or missing authentication token |
403 | FORBIDDEN | User lacks permission to update this database |
404 | NOT_FOUND | Database with given ID or FQN does not exist |
409 | CONFLICT | Concurrent modification detected |
Was this page helpful?
⌘I