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

Update and delete entity changes #87

Merged
merged 9 commits into from
Nov 27, 2023

Conversation

JulienR1
Copy link
Contributor

This PR adds support for OPERATION_UPDATE and OPERATION_DELETE.

  • OPERATION_UPDATE inserts the data normally into CH. This allows us to have a full history of every change that occurred. If the user really wants to replace the data, they can configure their table with a ReplacingMergeTree to upsert fields accordingly. See docs. This also pushes the burden of defining what field to compare when receiving new data to the user.

  • OPERATION_DELETE again does not remove the records from CH. Instead, it inserts them into another table (deleted_entity_changes) with all the default metadata fields. We then keep the full history once more. This also allows the user to query and filter on the deleted_entity_changes table to know which fields should not be used anymore. Problem: as far as I know, there is no baked in solution to easily remove fields with this approach. (I can only think of DELETE FROM table WHERE __ IN deleted_entity_changes or creating a materialized view with a filter clause).

@JulienR1 JulienR1 marked this pull request as ready for review November 23, 2023 15:38
Copy link
Contributor

@DenisCarriere DenisCarriere left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@DenisCarriere DenisCarriere merged commit 20f921d into main Nov 27, 2023
1 check passed
@JulienR1 JulienR1 deleted the feature/update-delete-entity-changes branch November 27, 2023 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants