ilyasahsan123 commented on PR #41331: URL: https://github.com/apache/beam/pull/41331#issuecomment-7154843113
> @ilyasahsan123 have you considered adding a new side output PCollection that is dedicated for notable metadata events (e.g. schema change)? I'm wondering if that would be a more intuitive shape for sinks to work with. > > The way it's handled now, a Sink would have to inspect each incoming element and identify if it is a data record or a metadata event. Nothing in the element says which kind it is, so it comes down to checking which keys are present > > Also +1 to @tkaymak's suggestion to make this an opt-in feature to avoid disrupting existing pipelines Thanks @ahmedabu98, agreed. A separate output is easier for sinks because they'd only get data records and wouldn't need to check keys. Right now `readAsJson()` puts everything into one `PCollection`: data changes (`before`/`after`), schema changes (`ddl`, `tableChanges`), and transaction `BEGIN`/`END` events. To write to a destination like BigQuery, you have to strip out the non-data keys first ([example](https://github.com/debezium/debezium-examples/blob/main/apache-beam/src/main/java/io/debezium/examples/apache/beam/MySQLToBigQueryCDC.java)) My proposal is an opt-in variant that returns a result object with: - `getRecords()`: data change events only - `getSchemaChanges()`: schema change events with ddl, tableChanges, etc. Okay if I open a separate PR for this? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
