Create table
POST/metalakes/:metalake/catalogs/:catalog/schemas/:schema/tables
Create table
Request
Path Parameters
The name of the metalake
The name of the catalog
The name of the schema
- application/json
Body
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- IdentityPartitioning
- YearPartitioning
- MonthPartitioning
- DayPartitioning
- HourPartitioning
- BucketPartitioning
- TruncatePartitioning
- ListPartitioning
- RangePartitioning
- FunctionPartitioning
Array [
]
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
]
Array [
]
The name of the table
columns
object[]
required
A list of columns
The name of the column
type
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The comment of the column
Default value: true
Whether the column is nullable
defaultValue
object
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Default value: false
Whether the column is auto increment
The comment of the table
properties
object
nullable
A map of table properties
sortOrders
object[]
nullable
Describes the sort order of the table data
sortTerm
object
required
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Possible values: [asc
, desc
]
Default value: asc
The direction of the sort order
Possible values: [nulls_first
, nulls_last
]
| The sort order of null values. The default value is "nulls_first" if the direction is "asc", otherwise "nulls_last".
distribution
object
nullable
Describes how data is distributed across partitions
Possible values: [hash
, range
, even
]
Default value: hash
The distribution strategy
The number of buckets/distribution
funcArgs
object[]
nullable
required
The arguments of the distribution function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
partitioning
object[]
nullable
partitioning of the table data
oneOf
Possible values: [identity
]
The name of the field, may be with multiple levels
Possible values: [year
]
The name of the field, may be with multiple levels
Possible values: [month
]
The name of the field, may be with multiple levels
Possible values: [day
]
The name of the field, may be with multiple levels
Possible values: [hour
]
The name of the field, may be with multiple levels
Possible values: [bucket
]
The number of buckets
The names of the fields, each field may be with multiple levels
Possible values: [truncate
]
The width of the truncate
The name of the field, may be with multiple levels
Possible values: [list
]
The names of the fields, each field may be with multiple levels
assignments
object[]
The pre-assigned list partitions
Possible values: [list
]
The name of the partition
The values of the partition
properties
object
nullable
The properties of the partition
Possible values: [range
]
The name of the field, may be with multiple levels
assignments
object[]
The pre-assigned range partitions
Possible values: [range
]
The name of the partition
upper
object
required
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
lower
object
required
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
properties
object
nullable
The properties of the partition
Possible values: [function
]
The name of the partitioning function
funcArgs
object[]
required
The arguments of the partitioning function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
indexes
object[]
nullable
Indexes of the table
Possible values: [primary_key
, unique_key
]
The name of the index
The names of the fields, each field may be with multiple levels
Responses
- 200
- 409
- 5xx
Returns include the table object
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- TableResponse
- MysqlTableResponse
- PostgresqlTableResponse
Schema
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- IdentityPartitioning
- YearPartitioning
- MonthPartitioning
- DayPartitioning
- HourPartitioning
- BucketPartitioning
- TruncatePartitioning
- ListPartitioning
- RangePartitioning
- FunctionPartitioning
Array [
]
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
Array [
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
]
Array [
]
Possible values: [0
]
Status code of the response
table
object
A table object
The name of the table
columns
object[]
required
A list of columns
The name of the column
type
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The comment of the column
Default value: true
Whether the column is nullable
defaultValue
object
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Default value: false
Whether the column is auto increment
The comment of the table
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 table properties
distribution
object
nullable
Describes how data is distributed across partitions
Possible values: [hash
, range
, even
]
Default value: hash
The distribution strategy
The number of buckets/distribution
funcArgs
object[]
nullable
required
The arguments of the distribution function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
sortOrders
object[]
nullable
Describes the sort order of the table data
sortTerm
object
required
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
Possible values: [asc
, desc
]
Default value: asc
The direction of the sort order
Possible values: [nulls_first
, nulls_last
]
| The sort order of null values. The default value is "nulls_first" if the direction is "asc", otherwise "nulls_last".
partitioning
object[]
nullable
partitioning of the table data
oneOf
Possible values: [identity
]
The name of the field, may be with multiple levels
Possible values: [year
]
The name of the field, may be with multiple levels
Possible values: [month
]
The name of the field, may be with multiple levels
Possible values: [day
]
The name of the field, may be with multiple levels
Possible values: [hour
]
The name of the field, may be with multiple levels
Possible values: [bucket
]
The number of buckets
The names of the fields, each field may be with multiple levels
Possible values: [truncate
]
The width of the truncate
The name of the field, may be with multiple levels
Possible values: [list
]
The names of the fields, each field may be with multiple levels
assignments
object[]
The pre-assigned list partitions
Possible values: [list
]
The name of the partition
The values of the partition
properties
object
nullable
The properties of the partition
Possible values: [range
]
The name of the field, may be with multiple levels
assignments
object[]
The pre-assigned range partitions
Possible values: [range
]
The name of the partition
upper
object
required
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
lower
object
required
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
properties
object
nullable
The properties of the partition
Possible values: [function
]
The name of the partitioning function
funcArgs
object[]
required
The arguments of the partitioning function
oneOf
Possible values: [literal
]
dataType
object
required
oneOf
string
Possible values: [struct
]
fields
object[]
required
The name of the struct field
Default value: true
Whether the struct field is nullable
The comment of the struct field
Possible values: [list
]
Default value: true
Whether the list contains null values
Possible values: [map
]
Default value: true
Whether the value of the map contains null values
Possible values: [union
]
Possible values: [unparsed
]
The unparsed type
The string format of the literal value
Possible values: [field
]
The name of the field, may be with multiple levels
Possible values: [function
]
The name of the function
The arguments of the function
indexes
object[]
nullable
Indexes of the table
Possible values: [primary_key
, unique_key
]
The name of the index
The names of the fields, each field may be with multiple levels
{
"code": 0,
"table": {
"name": "string",
"columns": [
{
"name": "string",
"type": [
"boolean",
"byte",
"byte unsigned",
"short",
"short unsigned",
"integer",
"integer unsigned",
"long",
"long unsigned",
"float",
"double",
"decimal(10,2)",
"date",
"time",
"timestamp",
"timestamp_tz",
"string",
"char(10)",
"varchar(10)",
"interval_day",
"interval_year",
"uuid",
"fixed(16)",
"binary"
],
"comment": "string",
"nullable": true,
"defaultValue": {},
"autoIncrement": false
}
],
"comment": "string",
"audit": {
"creator": "string",
"createTime": "2024-11-14T07:54:08.740Z",
"lastModifier": "string",
"lastModifiedTime": "2024-11-14T07:54:08.740Z"
},
"properties": {},
"distribution": {
"strategy": "hash",
"number": 0,
"funcArgs": [
{},
{},
{}
]
},
"sortOrders": [
{
"sortTerm": {},
"direction": "asc",
"nullOrdering": "nulls_first"
}
],
"partitioning": [
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"indexes": [
{
"indexType": "primary_key",
"name": "string",
"fieldNames": [
[
"string"
]
]
}
]
}
}
{
"code": 0,
"table": {
"name": "my_hive_table",
"comment": "This is my Hive table",
"columns": [
{
"name": "id",
"type": "integer",
"comment": "id column comment",
"nullable": true,
"autoIncrement": false
},
{
"name": "name",
"type": "string",
"comment": "name column comment",
"nullable": true
},
{
"name": "age",
"type": "integer",
"comment": "age column comment",
"nullable": true
},
{
"name": "dt",
"type": "date",
"comment": "dt column comment",
"nullable": true
}
],
"properties": {
"input-format": "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat",
"transient_lastDdlTime": "1702033666",
"output-format": "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat",
"location": "hdfs://0.0.0.0:9000/user/hive/warehouse/my_hive_table",
"table-type": "MANAGED_TABLE",
"serde-lib": "org.apache.hadoop.hive.ql.io.orc.OrcSerde",
"serde-name": "my_hive_table"
},
"audit": {
"creator": "gravitino",
"createTime": "2023-12-08T11:07:46.938Z"
},
"distribution": {
"strategy": "hash",
"number": 32,
"funcArgs": [
{
"type": "field",
"fieldName": [
"id"
]
}
]
},
"sortOrders": [
{
"sortTerm": {
"type": "field",
"fieldName": [
"age"
]
},
"direction": "asc",
"nullOrdering": "nulls_first"
}
],
"partitioning": [
{
"strategy": "identity",
"fieldName": [
"dt"
]
}
],
"indexes": []
}
}
{
"code": 0,
"table": {
"name": "my_mysql_table",
"comment": "This is my MySQL table",
"columns": [
{
"name": "id",
"type": "integer",
"comment": "id column comment",
"nullable": true,
"autoIncrement": true
},
{
"name": "name",
"type": "string",
"comment": "name column comment",
"nullable": true
},
{
"name": "age",
"type": "integer",
"comment": "age column comment",
"nullable": true
},
{
"name": "dt",
"type": "date",
"comment": "dt column comment",
"nullable": true
}
],
"properties": {
"engine": "InnoDB",
"auto-increment-offset": "1"
},
"audit": {
"creator": "gravitino",
"createTime": "2023-12-08T11:07:46.938Z"
},
"distribution": null,
"sortOrders": [],
"partitioning": [],
"indexes": [
{
"indexType": "primary_key",
"name": "PRIMARY",
"fieldNames": [
[
"id"
]
]
},
{
"indexType": "unique_key",
"name": "uk_1",
"fieldNames": [
[
"name"
]
]
},
{
"indexType": "unique_key",
"name": "uk_2",
"fieldNames": [
[
"name"
],
[
"age"
],
[
"dt"
]
]
}
]
}
}
{
"code": 0,
"table": {
"name": "my_postgresql_table",
"comment": "This is my PostgreSQL table",
"columns": [
{
"name": "id",
"type": "integer",
"comment": "id column comment",
"nullable": true,
"autoIncrement": true
},
{
"name": "name",
"type": "string",
"comment": "name column comment",
"nullable": true
},
{
"name": "age",
"type": "integer",
"comment": "age column comment",
"nullable": true
},
{
"name": "dt",
"type": "date",
"comment": "dt column comment",
"nullable": true
}
],
"properties": {},
"audit": {
"creator": "gravitino",
"createTime": "2023-12-08T11:07:46.938Z"
},
"distribution": null,
"sortOrders": [],
"partitioning": [],
"indexes": [
{
"indexType": "primary_key",
"name": "PRIMARY",
"fieldNames": [
[
"id"
]
]
},
{
"indexType": "unique_key",
"name": "uk_1",
"fieldNames": [
[
"name"
]
]
},
{
"indexType": "unique_key",
"name": "uk_2",
"fieldNames": [
[
"name"
],
[
"age"
],
[
"dt"
]
]
}
]
}
}
Conflict - The target table already exists
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- TableAlreadyExistsErrorResponse
Schema
Possible values: >= 1000
and <= 1100
HTTP response code
Internal type definition of the error
A human-readable message
{
"code": 1002,
"type": "string",
"message": "string",
"stack": [
"string"
]
}
{
"code": 1004,
"type": "TableAlreadyExistsException",
"message": "Failed to operate table(s) [my_hive_table] operation [CREATE] under schema [my_hive_schema], reason [TableAlreadyExistsException]",
"stack": [
"org.apache.gravitino.exceptions.TableAlreadyExistsException: Table already exists: my_hive_table",
"..."
]
}
A server-side problem that might not be addressable from the client side. Used for server 5xx errors without more specific documentation in individual routes.
- 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
{
"code": 1002,
"type": "string",
"message": "string",
"stack": [
"string"
]
}
{
"code": 1002,
"type": "RuntimeException",
"message": "Internal Server Error",
"stack": [
"java.lang.RuntimeException: Internal Server Error"
]
}