I'm streaming a few tables from MS SQL Server into Kafka using CDC and the Debezium connector. One of the SQL tables is represented in KSQL as a stream and the rest are KSQL tables that I want to join to the stream to enrich the data, so I have a chain of KSQL streams each joining a new KSQL table to the output of the previous KSQL stream in the chain.
Let A be a KSQL stream.
Let B through D be KSQL tables.
A + B = A'
A' + C = A''
A'' + D = A'''
This works just fine for A' and A'', but A''' is giving me the error: Source table (D) key column (X) is not the column used in the join criteria (Y). Why am I able to produce streams A' and A'' without incident but A''' gives me this error?
I found some SO questions that indicated I should rekey D using the PARTITION BY clause, but that causes another error: mismatched input 'PARTITION' expecting ';'. Seems like CREATE TABLE doesn't play nice with PARTITION BY, and if I use CREATE STREAM instead, it tells me I can't create a stream from a table and should use CREATE TABLE.
HALP!
UPDATE: Obfuscated query added.
CREATE STREAM A_Enriched_Phase7
WITH(PARTITIONS=1)
AS
SELECT *
FROM A_Enriched_Phase6 a
JOIN KsqlTableD d ON a.X = d.X
PARTITION BY a.ID;