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

<ParamField path="id" type="string" required>
  UUID of the database to retrieve.
</ParamField>

<ParamField query="fields" type="string">
  Comma-separated list of fields to include. Valid fields: `owners`, `databaseSchemas`, `usageSummary`, `location`, `tags`, `certification`, `extension`, `domains`, `sourceHash`, `followers`.
</ParamField>

<ParamField query="include" type="string" default="non-deleted">
  Include `all`, `deleted`, or `non-deleted` entities.
</ParamField>

## Get by Fully Qualified Name

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

<ParamField path="fqn" type="string" required>
  Fully qualified name of the database (e.g., `mysql_sample.default`).
</ParamField>

<ParamField query="fields" type="string">
  Comma-separated list of fields to include. Valid fields: `owners`, `databaseSchemas`, `usageSummary`, `location`, `tags`, `certification`, `extension`, `domains`, `sourceHash`, `followers`.
</ParamField>

<ParamField query="include" type="string" default="non-deleted">
  Include `all`, `deleted`, or `non-deleted` entities.
</ParamField>

<RequestExample dropdown>
  ```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}: {database.description}")

  # 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", "domain"]
  )
  ```

  ```java GET /v1/databases/{id} theme={null}
  import static org.openmetadata.sdk.fluent.Databases.*;

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

  // Get by fully qualified name
  Database database = Databases.retrieveByName("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}"
  ```
</RequestExample>

<ResponseExample>
  ```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"
  }
  ```
</ResponseExample>

***

## Returns

Returns a database object with all requested fields populated.

## Response

<ResponseField name="id" type="string">
  Unique identifier for the database (UUID format).
</ResponseField>

<ResponseField name="name" type="string">
  Database name.
</ResponseField>

<ResponseField name="fullyQualifiedName" type="string">
  Fully qualified name in format `service.database`.
</ResponseField>

<ResponseField name="displayName" type="string">
  Human-readable display name.
</ResponseField>

<ResponseField name="description" type="string">
  Description of the database in Markdown format.
</ResponseField>

<ResponseField name="service" type="object">
  Reference to the parent database service.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the database service.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of entity (always `databaseService`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the database service.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="serviceType" type="string">
  Type of database service (e.g., Snowflake, BigQuery, PostgreSQL).
</ResponseField>

<ResponseField name="version" type="number">
  Version number for the entity.
</ResponseField>

<ResponseField name="owners" type="array" optional>
  List of owners. Only included when `fields` contains `owners`.
</ResponseField>

<ResponseField name="tags" type="array" optional>
  Classification tags. Only included when `fields` contains `tags`.
</ResponseField>

<ResponseField name="domain" type="object" optional>
  Domain assignment. Only included when `fields` contains `domain`.
</ResponseField>

***

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