Create schema
POST/metalakes/:metalake/catalogs/:catalog/schemas
Creates a schema in the catalog and returns it, including its comment, properties and audit information.
Sign in with a bearer token or a local user's password; see Authentication.
Request
Path Parameters
The name of the metalake
The name of the catalog
- application/json
Body
The name of the schema. For catalogs that support hierarchical (multi-level) schemas, the name may encode a nested path joined by the configured schema separator (gravitino.schema.separator, default :), e.g. a:b:c creates schema c under the existing parent schema a:b.
A comment describing the schema
properties
object
nullable
A map of properties for the schema
Responses
- 200
- 409
- 5xx
The schema, with its comment, properties and audit information.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- SchemaResponse
Schema
Possible values: [0]
Status code of the response
schema
object
A schema
The name of the schema
A comment describing the schema
audit
object
required
Audit information for a Gravitino resource.
The user who created the resource
The time the resource was created
The user who last modified the resource
The time the resource was last modified
properties
object
nullable
A map of properties for the schema
{
"code": 0,
"schema": {
"name": "string",
"comment": "string",
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
},
"properties": {}
}
}
{
"code": 0,
"schema": {
"name": "my_hive_schema",
"comment": "This is my Hive schema",
"properties": {
"key1": "value1",
"key2": "value2",
"location": "hdfs://0.0.0.0:9000/user/hive/warehouse/my_hive_schema.db"
},
"audit": {
"creator": "gravitino",
"createTime": "2023-12-08T08:37:43.531Z"
}
}
}
A schema with the same name already exists in the catalog.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- SchemaAlreadyExistsErrorResponse
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1004,
"type": "SchemaAlreadyExistsException",
"message": "Failed to operate schema(s) [my_hive_schema] operation [CREATE] under catalog [my_hive_catalog], reason [SchemaAlreadyExistsException]",
"stack": [
"org.apache.gravitino.exceptions.SchemaAlreadyExistsException: Hive schema (database) 'my_hive_schema' already exists in Hive Metastore",
"..."
]
}
The server hit an internal error that the client usually cannot fix by changing the request.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- Example
Schema
Possible values: >= 1000 and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
Deprecated diagnostic stack trace. Enterprise omits it by default because it can expose internal implementation details. Operators can opt in for controlled diagnostics with gravitino.server.webserver.includeErrorStackTrace=true. See OWASP REST Security: Error handling and CWE-209.
{
"code": 1002,
"type": "string",
"message": "string"
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}