create stream `TEST` with (key_format='kafka',value_format='avro',partitions=3,value_avro_schema_full_name='Namespace.Avro.Test') as
select
extractjsonfield(event, '$.keyId'),
cast(extractjsonfield(event, '$.Field1') as int) `Field1`
from events
partition by extractjsonfield(event, '$.keyId')
emit changes;
It always creates a new schema version but I want it to read last schema version.
Why does the “create stream” command create two schema versions? It creates two similar schema versions, the difference is only the “connect.name” field.
“create stream” command:
create stream `TEST` with (key_format='kafka',value_format='avro',partitions=3,value_avro_schema_full_name='Namespace.Avro.Test') as
select
extractjsonfield(event, '$.keyId'),
cast(extractjsonfield(event, '$.Field1') as int) `Field1`
from events
partition by extractjsonfield(event, '$.keyId')
emit changes;
Can I avoid creating schema version with “connect.name” field?
Schema version with “connect.name” field:
ksqlDB currently does not have specific support for union schemas as described in your referenced blog post. However, you could define a “superset” schema which consists of all the possible fields across all schemas used in a topic. The Github issue you referenced is relevant, along with Support multi schema topics · Issue #1267 · confluentinc/ksql · GitHub.