Skip to content
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

DynamoDB: Change CrateDB data model to use (pk, data, aux) columns #64

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

amotl
Copy link
Member

@amotl amotl commented Sep 30, 2024

About

By breaking the primary key information out of the main record's data bucket, the main record can be updated as-is on CDC MODIFY operations.

References

@cla-bot cla-bot bot added the cla-signed label Sep 30, 2024
@amotl amotl marked this pull request as ready for review September 30, 2024 07:59
f"CREATE TABLE IF NOT EXISTS {self.table_name} "
f"({self.TYPED_COLUMN} OBJECT(DYNAMIC), {self.UNTYPED_COLUMN} OBJECT(IGNORED));"
f"CREATE TABLE IF NOT EXISTS {self.table_name} ("
f"{self.PK_COLUMN} OBJECT(DYNAMIC) AS ({', '.join(self.primary_key_schema.to_sql_ddl_clauses())}), "
Copy link
Member

@hammerhead hammerhead Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rather make the pk_column an OBJECT(STRICT)? The primary key cannot be changed on an existing table. Although it doesn't make a difference in practice, since the object isn't the primary key, but the elements inside. And an OBJECT(STRICT) also still can be changed through an ALTER TABLE ADD COLUMN. It just looks a bit untypical to have a dynamic PK. Are there scenarios where new attributes would be added to the PK object during runtime?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am absolutely fine using OBJECT(STRICT), as you are suggesting. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

By breaking the primary key information out of the main record's data
bucket, the main record can be updated as-is on CDC MODIFY operations.
@amotl amotl requested a review from hammerhead September 30, 2024 16:00
@amotl amotl merged commit adcb2ff into main Sep 30, 2024
23 checks passed
@amotl amotl deleted the dynamodb-fix-cdc branch September 30, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants