Skip to content

Conversation

Pavan-Nambi
Copy link
Contributor

@Pavan-Nambi Pavan-Nambi commented Sep 1, 2025

Fixes #2221

@Pavan-Nambi Pavan-Nambi requested a review from penberg as a code owner September 1, 2025 08:04
@github-actions github-actions bot added the docs label Sep 1, 2025
@penberg penberg changed the title document how to use cdc Document how to use CDC Sep 1, 2025
Copy link
Member

@notrab notrab left a 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.

Pavan-Nambi and others added 6 commits September 1, 2025 16:05
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>
@Pavan-Nambi
Copy link
Contributor Author

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.

@Pavan-Nambi
Copy link
Contributor Author

cc @notrab

Pavan-Nambi and others added 2 commits September 1, 2025 16:18
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.
Copy link
Contributor

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 │ │
Copy link
Contributor

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?

Copy link
Contributor

@sivukhin sivukhin left a 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.

Pavan-Nambi and others added 5 commits September 1, 2025 18:16
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)**
Copy link
Contributor Author

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.


Copy link
Contributor Author

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

@Pavan-Nambi
Copy link
Contributor Author

Pavan-Nambi commented Sep 1, 2025

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.

@penberg penberg merged commit da81e43 into tursodatabase:main Sep 2, 2025
49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to use CDC
4 participants