Update view
PUT/metalakes/:metalake/catalogs/:catalog/schemas/:schema/views/:view
Applies one or more changes to a view, such as a rename, property changes or a replacement of its body, and returns the updated view. When authorization is enabled, only an owner of the view or of an object that contains it can update the view.
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
The name of the schema
The name of the view
- application/json
Body
Array [
- RenameViewRequest
- SetViewPropertyRequest
- RemoveViewPropertyRequest
- ReplaceViewRequest
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
- ExternalType
Array [
- MOD1
- MOD2
]
- MOD1
- MOD2
- MOD1
- MOD2
- MOD1
- MOD2
Array [
- MOD1
- MOD2
]
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
- ExternalType
Array [
- MOD1
- MOD2
]
- MOD1
- MOD2
- MOD1
- MOD2
- MOD1
- MOD2
Array [
- MOD1
- MOD2
]
]
Array [
- SQLRepresentation
]
]
updates
object[]
required
Possible values: >= 1
oneOf
Possible values: [rename]
The new name of the view
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
Atomically replaces the body of a view. Columns, representations, default catalog, default schema and comment are all replaced. The view name and properties are not affected.
Possible values: [replaceView]
columns
object[]
required
Possible values: >= 1
The new output columns of the view, at least one is required
The name of the column
type
object
required
The general, read-compatible data type representation. UnparsedType preserves types that the current server cannot resolve when reading existing metadata. Endpoints that require resolved new metadata use WritableDataType instead.
oneOf
The string name of a primitive type, such as boolean, byte, byte unsigned, short, short unsigned, integer, integer unsigned, long, long unsigned, float, double, decimal(10,2), date, time(3), timestamp(3), timestamp_tz(3), string, char(10), varchar(10), interval_day, interval_year, uuid, fixed(16) or binary.
string
Possible values: [struct]
fields
object[]
required
The name of the struct field
type
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
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
elementType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [map]
keyType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
valueType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Default value: true
Whether the value of the map contains null values
Possible values: [union]
types
object[]
required
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [unparsed]
The unparsed type
Possible values: [external]
The string representation of this type in the catalog
The comment of the column
Default value: true
Whether the column is nullable
defaultValue
object
oneOf
Possible values: [literal]
dataType
object
required
The general, read-compatible data type representation. UnparsedType preserves types that the current server cannot resolve when reading existing metadata. Endpoints that require resolved new metadata use WritableDataType instead.
oneOf
The string name of a primitive type, such as boolean, byte, byte unsigned, short, short unsigned, integer, integer unsigned, long, long unsigned, float, double, decimal(10,2), date, time(3), timestamp(3), timestamp_tz(3), string, char(10), varchar(10), interval_day, interval_year, uuid, fixed(16) or binary.
string
Possible values: [struct]
fields
object[]
required
The name of the struct field
type
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
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
elementType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [map]
keyType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
valueType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Default value: true
Whether the value of the map contains null values
Possible values: [union]
types
object[]
required
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [unparsed]
The unparsed type
Possible values: [external]
The string representation of this type in the catalog
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
Whether the column is auto increment
representations
object[]
required
Possible values: >= 1
The new representations of the view, at least one is required
oneOf
Possible values: [sql]
The representation type discriminator
The SQL dialect of this representation
The SQL text of the view
The new default catalog, or null to unset it
The new default schema, or null to unset it
The new comment, or null to unset it
Responses
- 200
- 400
- 404
- 409
- 5xx
The view, with its columns, SQL representations, default catalog and schema, comment, properties and audit information.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- ViewResponse
Schema
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
- ExternalType
Array [
- MOD1
- MOD2
]
- MOD1
- MOD2
- MOD1
- MOD2
- MOD1
- MOD2
Array [
- MOD1
- MOD2
]
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
- ExternalType
Array [
- MOD1
- MOD2
]
- MOD1
- MOD2
- MOD1
- MOD2
- MOD1
- MOD2
Array [
- MOD1
- MOD2
]
]
Array [
- SQLRepresentation
]
Possible values: [0]
Status code of the response
view
object
The name of the view
The comment of the view
columns
object[]
required
The output columns of the view
The name of the column
type
object
required
The general, read-compatible data type representation. UnparsedType preserves types that the current server cannot resolve when reading existing metadata. Endpoints that require resolved new metadata use WritableDataType instead.
oneOf
The string name of a primitive type, such as boolean, byte, byte unsigned, short, short unsigned, integer, integer unsigned, long, long unsigned, float, double, decimal(10,2), date, time(3), timestamp(3), timestamp_tz(3), string, char(10), varchar(10), interval_day, interval_year, uuid, fixed(16) or binary.
string
Possible values: [struct]
fields
object[]
required
The name of the struct field
type
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
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
elementType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [map]
keyType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
valueType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Default value: true
Whether the value of the map contains null values
Possible values: [union]
types
object[]
required
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [unparsed]
The unparsed type
Possible values: [external]
The string representation of this type in the catalog
The comment of the column
Default value: true
Whether the column is nullable
defaultValue
object
oneOf
Possible values: [literal]
dataType
object
required
The general, read-compatible data type representation. UnparsedType preserves types that the current server cannot resolve when reading existing metadata. Endpoints that require resolved new metadata use WritableDataType instead.
oneOf
The string name of a primitive type, such as boolean, byte, byte unsigned, short, short unsigned, integer, integer unsigned, long, long unsigned, float, double, decimal(10,2), date, time(3), timestamp(3), timestamp_tz(3), string, char(10), varchar(10), interval_day, interval_year, uuid, fixed(16) or binary.
string
Possible values: [struct]
fields
object[]
required
The name of the struct field
type
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
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
elementType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [map]
keyType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
valueType
object
required
A nested data type, in any form that DataType describes.
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Default value: true
Whether the value of the map contains null values
Possible values: [union]
types
object[]
required
oneOf
A primitive type, as in PrimitiveType
string
A struct, list, map, union, unparsed or external type, as in DataType
object
Possible values: [unparsed]
The unparsed type
Possible values: [external]
The string representation of this type in the catalog
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
Whether the column is auto increment
representations
object[]
required
The representations of the view, keyed by dialect
oneOf
Possible values: [sql]
The representation type discriminator
The SQL dialect of this representation
The SQL text of the view
The default catalog used to resolve unqualified identifiers in the view representations
The default schema used to resolve unqualified identifiers in the view representations
properties
object
nullable
The properties of the view
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
{
"code": 0,
"view": {
"name": "string",
"comment": "string",
"columns": [
{
"name": "string",
"type": "integer",
"comment": "string",
"nullable": true,
"defaultValue": {
"type": "literal",
"dataType": "integer",
"value": "string"
},
"autoIncrement": false
}
],
"representations": [
{}
],
"defaultCatalog": "string",
"defaultSchema": "string",
"properties": {},
"audit": {
"creator": "string",
"createTime": "2024-07-29T15:51:28.071Z",
"lastModifier": "string",
"lastModifiedTime": "2024-07-29T15:51:28.071Z"
}
}
}
{
"code": 0,
"view": {
"name": "view1",
"comment": "This is a view",
"audit": {
"creator": "gravitino",
"createTime": "2024-01-01T00:00:00Z",
"lastModifier": "gravitino",
"lastModifiedTime": "2024-01-01T00:00:00Z"
},
"columns": [
{
"name": "id",
"type": "long",
"comment": "id column",
"nullable": true
}
],
"representations": [
{
"type": "sql",
"dialect": "trino",
"sql": "SELECT id FROM t"
}
],
"properties": {
"key": "value"
}
}
}
The request is malformed or fails validation, for example because of invalid JSON, a missing required field or an invalid parameter value. The body is normally an error model, although the server's middleware can return plain text instead.
- 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": 1003,
"type": "BadRequestException",
"message": "Malformed request"
}
The metalake, catalog, schema or view does not exist.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetalakeException
- NoSuchCatalogException
- NoSuchSchemaException
- NoSuchViewException
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": 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": "NoSuchViewException",
"message": "Failed to operate view(s) [test_view] operation [LOAD] under schema [test_schema], reason [NoSuchViewException]",
"stack": [
"org.apache.gravitino.exceptions.NoSuchViewException: View test_view does not exist",
"..."
]
}
A view with the new name already exists in the schema.
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- ViewAlreadyExistsErrorResponse
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": "ViewAlreadyExistsException",
"message": "Failed to operate view(s) [view1] operation [CREATE] under schema [test_schema], reason [ViewAlreadyExistsException]",
"stack": [
"org.apache.gravitino.exceptions.ViewAlreadyExistsException: View already exists: view1",
"..."
]
}
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"
]
}