Create view
POST/metalakes/:metalake/catalogs/:catalog/schemas/:schema/views
Create view
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 [
- SQLRepresentation
]
The name of the view
The comment of the view
columns
object[]
The output columns of the view
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
Whether the column is auto increment
representations
object[]
required
Possible values: >= 1
The 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 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
Responses
- 200
- 400
- 404
- 409
- 5xx
Returns include the view object
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- ViewResponse
Schema
Array [
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
- Literal
- Field
- Function
- PrimitiveType
- StructType
- ListType
- MapType
- UnionType
- UnparsedType
Array [
]
]
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
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
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": [
"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)",
"binary"
],
"comment": "string",
"nullable": true,
"defaultValue": {},
"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"
}
}
}
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 schema does not exist
- application/vnd.gravitino.v1+json
- Schema
- Example (from schema)
- NoSuchMetalakeException
- NoSuchCatalogException
- NoSuchSchemaException
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",
"..."
]
}
Conflict - The target view already exists
- 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
{
"code": 1002,
"type": "string",
"message": "string",
"stack": [
"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",
"..."
]
}
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"
]
}