GENERATE CHANGELOG DDL
Syntax
GENERATE CHANGLEOG DDL changelog_name WITH(stream_parameter = value [, ...]);
GENERATE CHANGLEOG DDL changelog_name PRIMARY KEY(pk_name) WITH(stream_parameter = value [, ...]);
Description
This command generates a CREATE DDL for CHANGELOG from a given schema or data — for example, Data Store — that has corresponding Protocol Buffers and Descriptors. The command specially simplifies creating DDL for complex descriptors.
You can generate DDL if the current role has USAGE
privileges on the Data Store.
Changelog Parameters
primary key
If you provide the primary key names they are added to the DDL. Otherwise, this is empty. Required? No.
topic
Name of the Kafka topic whose assigned data schema you're using (for Protobuf descriptor and Avro schema from SchemaRegistry). Required? Yes, for AVRO, PROTOBUF
A string containing one or more JSON objects separated by commas. It serves as a data sample you use to infer the schema of the value field in Kafka.
Required? Required only for JSON
Generating "Create Changelog" DDL examples
Generate a "create changelog" ddl for an entity in the current store, which includes a protobuf descriptor.
GENERATE CHANGELOG DDL myChangelog with('topic'='pageviews_pb', 'value.format'='protobuf',
'key.format'='protobuf');
The output would be:
CREATE CHANGELOG myChangelog(
"viewtime" BIGINT NOT NULL,
"userid" VARCHAR NOT NULL,
"pageid" VARCHAR NOT NULL,
PRIMARY KEY()
) WITH ('key.format'='protobuf', 'key.type'='STRUCT<"userid" VARCHAR>', 'topic'='pageviews_pb', 'value.format'='protobuf');
Generate a "create changelog" ddl for an entity in the current store, which includes AVRO in the Confluent Schema Registry.
GENERATE CHANGELOG DDL myChangelog with('topic'='pageviews_avro', 'value.format'='avro',
'key.format'='avro');
The output would be
CREATE CHANGELOG myChangelog(
"viewtime" BIGINT ,
"userid" VARCHAR ,
"pageid" VARCHAR ,
PRIMARY KEY()
) WITH ('key.format'='avro', 'key.type'='STRUCT<"userid" VARCHAR>', 'topic'='pageviews_avro', 'value.format'='avro');
Generate a "create changelog" ddl for an entity whose content is JSON.
GENERATE CHANGELOG DDL myChangelog with ('value.format'='json', 'data.json.value.content'='{"viewtime":1629453600000,"userid":"user_123","pageid":"page_1"},{"viewtime":1629457200000,"userid":"user_456","pageid":"page_2"},{"viewtime":1629460800000,"userid":"user_789","pageid":"page_3"}' );
The output would be
CREATE CHANGELOG myChangelog(
"viewtime" BIGINT,
"userid" VARCHAR,
"pageid" VARCHAR,
PRIMARY KEY()
) WITH ('value.format'='json');
Last updated