> ## 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.

# Retrieve a Database

> Get a database by ID or fully qualified name

# Retrieve a Database

Get a single database by its unique ID or fully qualified name.

## Get by ID

**id** `string` *required*

UUID of the database to retrieve.

**fields** `string`

Comma-separated list of fields to include. Valid fields: `owners`, `databaseSchemas`, `usageSummary`, `location`, `tags`, `certification`, `extension`, `domains`, `sourceHash`, `followers`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

## Get by Fully Qualified Name

Use `GET /v1/databases/name/{fqn}` to retrieve by fully qualified name.

**fqn** `string` *required*

Fully qualified name of the database, for example `mysql_sample.default`.

**fields** `string`

Comma-separated list of fields to include. Valid fields: `owners`, `databaseSchemas`, `usageSummary`, `location`, `tags`, `certification`, `extension`, `domains`, `sourceHash`, `followers`.

**include** `string` (default: non-deleted)

Include `all`, `deleted`, or `non-deleted` entities.

```python GET /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"
)

# Get by ID
database = Databases.retrieve("550e8400-e29b-41d4-a716-446655440000")
print(f"{database.fullyQualifiedName.root}: {database.name.root}")

# Get by ID with fields
database = Databases.retrieve(
    "550e8400-e29b-41d4-a716-446655440000",
    fields=["owners", "tags", "usageSummary"]
)

# Get by fully qualified name
database = Databases.retrieve_by_name("snowflake_prod.analytics")

# Get by name with fields
database = Databases.retrieve_by_name(
    "snowflake_prod.analytics",
    fields=["owners", "tags", "domains"]
)
```

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

// client is an initialized OpenMetadataClient.

// Get by ID
Database database = client.databases().get("550e8400-e29b-41d4-a716-446655440000");

// Get by fully qualified name
Database databaseByName = client.databases().getByName("snowflake_prod.analytics");
```

```bash GET /v1/databases/{id} theme={null}
# Get by ID
curl "{base_url}/api/v1/databases/1d08c2c6-cea7-4adf-9043-0f6a6aaf9721" \
  -H "Authorization: Bearer {access_token}"

# Get by ID with fields
curl "{base_url}/api/v1/databases/1d08c2c6-cea7-4adf-9043-0f6a6aaf9721?fields=owners,databaseSchemas,tags" \
  -H "Authorization: Bearer {access_token}"

# Get by fully qualified name
curl "{base_url}/api/v1/databases/name/mysql_sample.default" \
  -H "Authorization: Bearer {access_token}"

# Get by name with fields
curl "{base_url}/api/v1/databases/name/mysql_sample.default?fields=owners,tags,domains" \
  -H "Authorization: Bearer {access_token}"
```

```json Response theme={null}
{
  "id": "1d08c2c6-cea7-4adf-9043-0f6a6aaf9721",
  "name": "default",
  "fullyQualifiedName": "mysql_sample.default",
  "tags": [],
  "version": 0.1,
  "updatedAt": 1769982658682,
  "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",
  "databaseSchemas": [
    {
      "id": "ea2cfeb5-8daa-434d-ae22-1f56c688aa86",
      "type": "databaseSchema",
      "name": "posts_db",
      "fullyQualifiedName": "mysql_sample.default.posts_db",
      "displayName": "posts_db",
      "deleted": false,
      "href": "http://localhost:8585/api/v1/databaseSchemas/ea2cfeb5-8daa-434d-ae22-1f56c688aa86"
    }
  ],
  "default": false,
  "deleted": false,
  "sourceUrl": "https://localhost:3306/posts_db",
  "domains": [],
  "entityStatus": "Unprocessed"
}
```

***

## Returns

Returns a database object with all requested fields populated.

## Response

**id** `string`

Unique identifier for the database (UUID format).

**name** `string`

Database name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.database`.

**displayName** `string`

Human-readable display name.

**description** `string`

Description of the database in Markdown format.

**service** `object`

Reference to the parent database service.

**properties**

**id** `string`

UUID of the database service.

**type** `string`

Type of entity (always `databaseService`).

**name** `string`

Name of the database service.

**serviceType** `string`

Type of database service, for example Snowflake, BigQuery, PostgreSQL.

**version** `number`

Version number for the entity.

**owners** `array`

List of owners. Only included when `fields` contains `owners`.

**tags** `array`

Classification tags. Only included when `fields` contains `tags`.

**domains** `array`

Domain assignment. Only included when `fields` contains `domains`.

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to view this database |
| `404` | `NOT_FOUND` | Database with given ID or FQN does not exist |


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