feat(bigquery): implement watermark column query based replication for bigquery sources - #4739
feat(bigquery): implement watermark column query based replication for bigquery sources#4739dtunikov wants to merge 2 commits into
Conversation
| BigqueryCdcEventsFunction bigquery_cdc_events_function = 10; | ||
| // the column to use as a cursor for query-based CDC replication | ||
| // required if replication_mode is BIGQUERY_REPLICATION_MODE_QUERY | ||
| string watermark_column = 11; |
There was a problem hiding this comment.
The plan is to have an option on the UI to configure watermark_column per table + to be able to type in a global watermark_column name (since in most cases the same column name is used for all tables, like created_at).
I think it can be handled completely on the UI and here we just get the column for every configured table.
There was a problem hiding this comment.
another thing is that I decided not to add bigquery_ prefix to its name, because it might be used for other query-based CDC connectors in the future.
Code reviewTwo issues found. Checked for bugs and CLAUDE.md compliance. 1.
|
This PR implement the third BigQuery replication mode - query based replication based on user-specified watermark/cursor column (for example
created_at).TableMappingcalled watermark_column. It's a required field for BigQuery sources with query-based replication mode.pullTableQueryfunction in biguqery/cdc.go. It fetches data from the table using a simple SQL query like:SELECT ... FROM ... WHERE col > lower AND col <= upper.SELECT max(watermark_column) FROM tableas a snapshot boundary and store it as an initial CDC checkpoint. So, in this mode we don't useFOR SYSTEM_TIME AS OF TIMESTAMP, instead we query:SELECT ... FROM ... WHERE col < max(watermark_col).Resolves DBI-1056.