Update table
PUT/metalakes/:metalake/catalogs/:catalog/schemas/:schema/tables/:table
Updates the specified table in a schema
Request
Path Parameters
The name of the metalake
The name of the catalog
The name of the schema
The name of the table
- application/json
Body
Array [
- RenameTableRequest
- UpdateTableCommentRequest
- SetTablePropertyRequest
- RemoveTablePropertyRequest
- AddTableColumnRequest
- RenameTableColumnRequest
- UpdateTableColumnTypeRequest
- UpdateTableColumnCommentRequest
- UpdateTableColumnPositionRequest
- UpdateTableColumnNullabilityRequest
- UpdateTableColumnDefaultValueRequest
- DeleteTableColumnRequest
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- FirstColumnPosition
- AfterColumnPosition
- DefaultColumnPosition
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- FirstColumnPosition
- AfterColumnPosition
- DefaultColumnPosition
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
updates
object[]
required
oneOf
Possible values: [rename
]
The new name of the table
Possible values: [updateComment
]
The new comment of the table
Possible values: [setProperty
]
The name of the property to set
The value of the property to set
Possible values: [removeProperty
]
The name of the property to remove
Possible values: [addColumn
]
The name of the field, may be with multiple levels
type
object
required
The type of the column to add
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 to add
position
object
nullable
The position of the column to add
oneOf
string
The name of the column which the new column will be added after
string
Default value: true
Whether the column to add is nullable
Default value: false
Whether the column to add should auto increment
defaultValue
object
nullable
The default value of the column to add
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: [renameColumn
]
The name of the field, may be with multiple levels
The new name of the field
Possible values: [updateColumnType
]
The name of the field, may be with multiple levels
newType
object
required
The new type of the column
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
Possible values: [updateColumnComment
]
The name of the field, may be with multiple levels
The new comment of the column
Possible values: [updateColumnPosition
]
The name of the field, may be with multiple levels
newPosition
object
required
The new position of the column
oneOf
string
The name of the column which the new column will be added after
string
Possible values: [updateColumnNullability
]
The name of the field, may be with multiple levels
Whether the column is nullable
Possible values: [updateColumnDefaultValue
]
The name of the field, may be with multiple levels
newDefaultValue
object
required
The new default value of the column
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: [deleteColumn
]
The name of the field, may be with multiple levels
Default value: false
If true, the request will not fail if the column does not exist
Responses
- 200
- 400
- 404
- 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.773Z",
"lastModifier": "string",
"lastModifiedTime": "2024-11-14T07:54:08.773Z"
},
"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"
]
]
}
]
}
}
Indicates a bad request error. It could be caused by an unexpected request body format or other forms of request validation failure, such as invalid json. Usually serves application/json content, although in some cases simple text/plain content might be returned by the server's middleware.
- 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": 1003,
"type": "BadRequestException",
"message": "Malformed request"
}
Not Found - The target table does not exist
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetalakeException
- NoSuchCatalogException
- NoSuchSchemaException
- NoSuchTableException
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": 1003,
"type": "NoSuchMetalakeException",
"message": "Failed to operate metalake(s) [test] operation [LOAD], reason [NoSuchMetalakeException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchMetalakeException: Metalake test does not exist",
"..."
]
}
{
"code": 1003,
"type": "NoSuchCatalogException",
"message": "Failed to operate catalog(s) [test] operation [LOAD] under metalake [my_test_metalake], reason [NoSuchCatalogException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchCatalogException: Catalog my_test_metalake.test does not exist",
"..."
]
}
{
"code": 1003,
"type": "NoSuchSchemaException",
"message": "Failed to operate schema(s) [my_hive_schema1] operation [LOAD] under catalog [my_hive_catalog], reason [NoSuchSchemaException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchSchemaException: Hive schema (database) does not exist: my_hive_schema1 in Hive Metastore",
"..."
]
}
{
"code": 1003,
"type": "NoSuchTableException",
"message": "Failed to operate table(s) [test_table] operation [LOAD] under schema [test_schema], reason [NoSuchTableException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchTableException: Hive table does not exist: test_table in Hive Metastore",
"..."
]
}
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"
]
}