snowflakedb/snowflake-kafka-connector

Ordinal Position of Columns with Schematization

Closed this issue · 1 comments

Hello Snowflake Team,

I am working on PoC where I want to land all the metadata columns before any of the record_content columns. I'm using SMT with the connector but I'm unable to change ordinal position of the metadata columns.

"snowflake.enable.schematization": "TRUE",
        "snowflake.ingestion.method": "SNOWPIPE_STREAMING",
"transforms": "insert",
        "transforms.insert.type": "org.apache.kafka.connect.transforms.InsertField$Value",
        "transforms.insert.timestamp.field": "k$pos",
        "transforms.insert.partition.field": "k$part",
        "transforms.insert.offset.field": "k$ofs",
        "transforms.insert.topic.field": "k$topic"

Hi @onerishabh,

If you want to have a predefined column order in a target table, you can create the table yourself with the metadata columns specified first. E.g.

create table sink_table (
    k$pos varchar,
    k$part varchar,
    k$ofs varchar,
    k$topic varchar
);

alter table sink_table set ENABLE_SCHEMA_EVOLUTION = true;

I'm also curious, why would you need columns in a specific order? Isn't it possible to reference them by their names?