CREATE ENTITY

Syntax

CREATE ENTITY fully_qualified_entity_name
[IN STORE store_name]
[WITH (entity_parameter = value [, ...])];

Description

This command creates a new Entity supported by a Store. These Entities can then be used to host Relations created through DDL or Query.

The entities created by this command can be listed using LIST ENTITIES.

Arguments

fully_qualified_entity_name

The full name of the Entity to create.

IN STORE store_name

Optionally, this creates the Entity in the specified Store. For case-sensitive names, the name must be wrapped in double quotes, otherwise, the lowercased name will be used.

WITH (entity_parameter = value [, …​])

This clause specifies Entity Parameters.

Entity Parameters

Parameter NameDescription

key.descriptor

A qualified Descriptor name used to decode a record's key, if applicable. Reset the Descriptor by setting it to NULL.

Required: No Default value: None Type: String Valid values: See LIST DESCRIPTORS.

value.descriptor

A qualified Descriptor name used to decode a record's value. Reset the Descriptor by setting it to NULL.

Required: No Default value: None Type: String Valid values: See LIST DESCRIPTORS.

Kafka Specific Entity Parameters

Parameters to be used if the associated Store is type KAFKA:

Parameter NameDescription

topic.partitions

The number of partitions to use when creating the Entity.

Required: No Default value: 1 Type: Integer Valid values: [1,…]

topic.replicas

The number of replicas to use when creating the Entity.

Required: No Default value: 1 Type: Integer Valid values: [1,…]

kafka.topic.*

A configuration specific for the topic that will be created, e.g. Kafka Topic Configuration for Confluent Platform. Required: No Default value: None Type: String Valid values: Kafka topic configuration specific to the underlying Storetype.

Kinesis Specific Entity Parameters

Parameters to be used if the associated Store is type KINESIS:

Parameter NameDescription

kinesis.shards

The number of shards to use when creating the Entity.

Required: No Default value: 1 Type: Integer Valid values: [1,…]

Examples

Create a new Kafka topic with defaults

The following creates a Entity called pageviews using the default parameters in the user's default Store:

demodb.public/kafka_store# CREATE ENTITY pageviews;

Create a new Kafka topic with key and value ProtoBuf Descriptors

The following creates a Entity called pageviews_pb in the user's default store. It also sets the key and value Descriptors that are necessary for serializing its records:

demodb.public/demostore# SHOW DESCRIPTORS;
         Name
----------------------
  pb.pageviews_key
  pb.pageviews_value

demodb.public/demostore# CREATE ENTITY pageviews_pb WITH ( 'key.descriptor' = 'pb.pageviews_key', 'value.descriptor' = 'pb.pageviews_value' );
demodb.public/demostore# DESCRIBE ENTITY pageviews_pb;
       Name       | Partitons | Replicas |     Key descriptor     |    Value descriptor    
------------------+-----------+----------+------------------------+------------------------
   transactions   |         1 |        2 |   pb.pageviews_key     |   pb.pageviews_value

Create a new Entity in Kinesis Store with Kinesis parameters

The following creates a Entity called pageviews_kinesis in the store named kinesis_store with 3 shards:

demodb.public/demostore# CREATE ENTITY pageviews_kinesis IN STORE kinesis_store WITH ('kinesis.shards' = 3);

Create a Snowflake database

demodb.public/sfstore# CREATE ENTITY "DELTA_STREAMING";
demodb.public/sfstore# LIST ENTITIES;
       Entity name       
-------------------------
  DELTA_STREAMING        
  SNOWFLAKE              
  SNOWFLAKE_SAMPLE_DATA  

Create a Snowflake schema in a database

In this example we create a new schema within the existing DELTA_STREAMING Snowflake database:

demodb.public/sfstore# CREATE ENTITY "DELTA_STREAMING"."MY_STREAMING_SCHEMA";
demodb.public/sfstore# LIST ENTITIES IN "DELTA_STREAMING";
      Entity name      
-----------------------
  INFORMATION_SCHEMA   
  MY_STREAMING_SCHEMA  
  PUBLIC               

Create a Databricks catalog

demodb.public/databricks_store# CREATE ENTITY cat1;
demodb.public/databricks_store# LIST ENTITIES;
        Entity name
---------------------------
  cat1
  main
  system

Create a Databricks schema in a catalog

In this example we create a new schema within the existing DELTA_STREAMING Snowflake database:

demodb.public/databricks_store# CREATE ENTITY cat1.schema1;
demodb.public/databricks_store# LIST ENTITIES IN cat1;
     Entity name
----------------------
  default
  information_schema
  schema1 

Last updated