-
Notifications
You must be signed in to change notification settings - Fork 524
Document how to use CDC #2871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to use CDC #2871
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great contribution @Pavan-Nambi!
@sivukhin and I were just discussing updating the docs to include this, so amazing you contributed just in time! 🤩
I've left a few suggestions, @sivukhin and I can go through these, and once applied, we can get this merged.
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Hey, thanks, i accepted commit suggestions , btw can u provide any input at #1993 - it's related to cdc - i m not exactly sure if that's what we want. thanks. |
cc @notrab |
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
|
||
``` | ||
|
||
If you modify your table schema (adding/dropping columns), the `table_columns_json_array()` function returns the current schema, not the historical one. This can lead to incorrect results when decoding older CDC records. Manually track schema versions by storing the output of `table_columns_json_array()` before making schema changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is first mention of that function. Let's create small section which will describe "helper" function to work with CDC (table_columns_json_array
and bin_record_json_object
)
├───────────┼─────────────┼─────────────┼───────────────┼────┼──────────┼──────────────────────────────────────────────────────────────────────────────┼───────────────┤ | ||
│ 2 │ 1756713176 │ 1 │ users │ 1 │ │ John │ │ | ||
├───────────┼─────────────┼─────────────┼───────────────┼────┼──────────┼──────────────────────────────────────────────────────────────────────────────┼───────────────┤ | ||
│ 3 │ 1756713176 │ 1 │ users │ 2 │ │ Jane │ │ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use helper functions in the example in order to have human-readable before/after columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Pavan-Nambi, thanks a lot for the contribution!
I left few comments and some of them can be bit more complex than other NITs. So feel free to delay comments fixes if they are unclear to you.
Generally, I think this is great start and we can merge this PR and improve docs on top of this work in separate branches.
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
Co-authored-by: Jamie Barton <jamie@notrab.dev>
|
||
|
||
|
||
- **`change_id` (INTEGER)** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got most of this from test_cdc , if i wrote anything wrong lmk, thanks
Granular details about the change. | ||
- For UPDATE: shows specific column modifications. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am assuming this is intended behaviour, when i tried cdc with transactions, this is the behaviour i experienced
I did not resolved this comment - this.. i m not sure either , tbh that table looks readable to me but perhaps we can make it more clear with just displaying before and after? idk. this comment - not really sure how these functions work - sorry i am new to codebase. |
Fixes #2221