CREATE TABLE

CREATE TABLE

Syntax

CREATE TABLE table_name (

   column_name data_type [, ...]

) WITH (table_parameter = value [, ...]);

Description

This DDL statement is used to define a new Table.

Note Currently, you can use CREATE TABLE only to define a new table backed by a pre-existing Iceberg Table.

Arguments

table_name

Specifies the name of the table. If the name is case sensitive you must wrap it in double quotes; otherwise the system uses the lower case name.

column_name

The name of a column in the stream. If the name is case sensitive you must wrap it in double quotes; otherwise the system uses the lower case name.

data_type

The data type of the column. This can include array specifiers. For more information on the data types supported by DeltaStream, see the Data Types reference.

WITH (table_parameter = value [, …​ ])

Optionally, this clause specifies table parameters.

Table Parameters

Parameter Name
Description

store

The name of the store that hosts the entity for this stream.

Required: No Default value: User’s default Data Store.

Type: String Valid values: See LIST STORES

Snowflake-Specific Parameters

Parameter Name
Description

snowflake.db.name

The name of the Snowflake database that would host the Snowflake Table.

Required: Yes Default values: None Type: String Valid values: Database names available from LIST ENTITIES.

snowflake.schema.name

The name of the Snowflake schema that would host the Snowflake Table.

Required: Yes Default value: None Type: String Valid values: Schema names available from LIST ENTITIES under the snowflake.db.name database name.

snowflake.table.name

The name of the Snowflake table to use when creating the Table. If the table doesn't exist in the store, a table with the table_name is created in the corresponding store. Required: No Default value: table_name Type: String

snowflake.buffer.millis

The amount of time to buffer events with the sink Table before writing the data into the corresponding Snowflake table.

It is important to note that the longer events are buffered, the larger the internal state of the query gets. Depending on the volume and size of the events for the corresponding query, memory limitations may be reached. Required: No Default value: 1000 Type: Long Valid values: (0, ...]

Snowflake stores provide a delivery guarantee of at_least_once when producing events into a sink Table. Snowflake stores provide an insert-only mode when writing to Snowflake tables.

Databricks-Specific Parameters

Parameter Name
Description

databricks.catalog.name

The name of the Databricks catalog that would host the Databricks Table.

Required: Yes Default values: None Type: String Valid values: Database names available from LIST ENTITIES.

databricks.schema.name

The name of the Databricks schema that would host the Databricks Table.

Required: Yes Default value: None Type: String Valid values: Schema names available from LIST ENTITIES under the databricks.catalog.name catalog name.

databricks.table.name

The name of the Databricks table to use when creating the Table. A table with the table_name is created in the corresponding store. If that table already exists, then an error is reported back to the user. Required: No Default value: table_name Type: String

table.data.file.location

The S3 directory location for the Delta-formatted data to be written. This location is either a full S3 path, or a relative path to the data store's Cloud Provider Bucket (see CREATE STORE). The credentials for writing to S3 are given during data store creation (see CREATE STORE). Note that the S3 bucket from the location specified by this parameter must match the databricks.cloud.s3.bucket property defined in the data store. Required: Yes Default value: None Type: String

Databricks stores provide a delivery guarantee of exactly_once when producing events into a sink Table. Databricks stores provide an insert-only mode when writing to Databricks tables.

Postgres-Specific Parameters

Parameter Name
Description

postgresql.db.name

Required: Yes

See CDC source parameters for the same parameter name

postgresql.schema.name

Required: Yes

See CDC source parameters for the same parameter name

postgresql.table.name

Required: No

See CDC source parameters for the same parameter name

Iceberg-Specific Parameters

Parameter Name
Description

iceberg.aws.glue.db.name

The name of the database (namespace) in the AWS Glue instance (used as the Iceberg Catalog implementation in the Iceberg Store) containing the existing Iceberg table. Required: Yes

Type: String

iceberg.aws.glue.table.name

The name of the existing Iceberg table in the AWS Glue instance (used as the Iceberg Catalog implementation in the Iceberg Store).

Required: Yes

Type: String

Example

Create a new table backed by an Iceberg table

The following creates a new Table, named pageviews_iceberg. This table is backed by an existing Iceberg table, called iceberg_table in the iceberg_store store. iceberg_table is defined in the gluedb database in the AWS Glue catalog, used by the store.

CREATE TABLE pageviews_iceberg (
  viewtime BIGINT, 
  userid VARCHAR, 
  pageid VARCHAR) WITH (
  'store'='iceberg_store',
  'iceberg.aws.glue.db.name'='gluedb',
  'iceberg.aws.glue.table.name'='iceberg_table'
);

Last updated