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

# Create a Database Schema

> Create a new database schema within a database

# Create a Database Schema

Create a new database schema within a database.

## Body Parameters

**name** `string` *required*

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

**database** `string` *required*

Fully qualified name of the parent Database.

**displayName** `string`

Human-readable display name for the schema.

**description** `string`

Description of the schema 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 schema.

**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 schema.

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

```python POST /v1/databaseSchemas theme={null}
from metadata.sdk import configure
from metadata.sdk.entities import DatabaseSchemas
from metadata.generated.schema.api.data.createDatabaseSchema import CreateDatabaseSchemaRequest

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

request = CreateDatabaseSchemaRequest(
    name="public",
    displayName="Public Schema",
    database="snowflake_prod.analytics",
    description="Main public schema for analytics tables",
    retentionPeriod="P365D"
)

schema = DatabaseSchemas.create(request)
print(f"Created: {schema.fullyQualifiedName.root}")
```

```java POST /v1/databaseSchemas theme={null}
import org.openmetadata.schema.entity.data.DatabaseSchema;
import org.openmetadata.sdk.fluent.builders.DatabaseSchemaBuilder;

DatabaseSchema schema = new DatabaseSchemaBuilder(client)
    .name("public")
    .databaseFQN("snowflake_prod.analytics")
    .create();
```

```bash POST /v1/databaseSchemas theme={null}
curl -X POST "{base_url}/api/v1/databaseSchemas" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "information_schema",
    "database": "Glue.default",
    "description": "This **mock** database contains tables related to the Glue service"
  }'
```

```json Response theme={null}
{
  "id": "f681432b-e66c-4096-a1cd-7771358c5323",
  "name": "information_schema",
  "fullyQualifiedName": "Glue.default.information_schema",
  "description": "This **mock** database contains tables related to the Glue service",
  "version": 0.1,
  "updatedAt": 1769982658171,
  "updatedBy": "admin",
  "href": "http://localhost:8585/api/v1/databaseSchemas/f681432b-e66c-4096-a1cd-7771358c5323",
  "owners": [],
  "service": {
    "id": "0fab117a-4c58-4ebb-9d42-beab0768fa8e",
    "type": "databaseService",
    "name": "Glue",
    "fullyQualifiedName": "Glue",
    "displayName": "Glue",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/services/databaseServices/0fab117a-4c58-4ebb-9d42-beab0768fa8e"
  },
  "serviceType": "Glue",
  "database": {
    "id": "9655ba5b-b8d7-419c-98f4-16b976692ad8",
    "type": "database",
    "name": "default",
    "fullyQualifiedName": "Glue.default",
    "description": "This **mock** database contains tables related to the Glue service",
    "displayName": "default",
    "deleted": false,
    "href": "http://localhost:8585/api/v1/databases/9655ba5b-b8d7-419c-98f4-16b976692ad8"
  },
  "tags": [],
  "deleted": false,
  "sourceUrl": "https://www.glue.com/information_schema",
  "domains": [],
  "entityStatus": "Unprocessed"
}
```

***

## Returns

Returns the created database schema object with all specified properties and system-generated fields.

## Response

**id** `string`

Unique identifier for the database schema (UUID format).

**name** `string`

Schema name.

**fullyQualifiedName** `string`

Fully qualified name in format `service.database.schema`.

**displayName** `string`

Human-readable display name.

**description** `string`

Description of the schema in Markdown format.

**database** `object`

Reference to the parent database.

**properties**

**id** `string`

UUID of the database.

**type** `string`

Type of entity (always `database`).

**name** `string`

Name of the database.

**fullyQualifiedName** `string`

Fully qualified name of the database.

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

**retentionPeriod** `string`

Data retention period in ISO 8601 duration format.

**owners** `array`

List of owners assigned to the schema.

**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`

Domain assignments for the schema.

**tags** `array`

Classification tags applied to the schema.

**properties**

**tagFQN** `string`

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.

**version** `number`

Version number for the entity (starts at 0.1).

***

## Create or Update (PUT)

Use `PUT /v1/databaseSchemas` instead of `POST` to perform an upsert. If a database schema with the same `fullyQualifiedName` already exists, it will be updated; otherwise, a new schema is created. The request body is the same as `POST`.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/databaseSchemas" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ ... same body as POST ... }'
```

> [!NOTE]
>
> `PUT` will not return a `409` conflict error if the entity already exists -- it will update the existing entity instead.

***

## Bulk Create or Update (PUT)

Use `PUT /v1/databaseSchemas/bulk` to create or update multiple database schemas in a single request. The request body is an array of create request objects.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/databaseSchemas/bulk" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "schema_one", "database": "service.db" },
    { "name": "schema_two", "database": "service.db" }
  ]'
```

***

## Error Handling

| Code | Error Type | Description |
| - | - | - |
| `400` | `BAD_REQUEST` | Invalid request body or missing required fields |
| `401` | `UNAUTHORIZED` | Invalid or missing authentication token |
| `403` | `FORBIDDEN` | User lacks permission to create database schemas |
| `409` | `ENTITY_ALREADY_EXISTS` | Schema with same name already exists in database (POST only) |


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