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

Support Restatements on SCD Type 2 and Use Them When Creating Preview Clone #3642

Open
eakmanrq opened this issue Jan 16, 2025 · 2 comments
Open
Labels
Improvement Improves existing functionality

Comments

@eakmanrq
Copy link
Contributor

eakmanrq commented Jan 16, 2025

Currently SCD Type 2 supports only restating the model from the beginning of time. One could also restate a model at any point in history too but also end with the latest date. This how how it would work:

Lets say I am restating Jan 10th

  • Delete from the table where all valid_from >= Jan 10th
  • Update the table where all valid_to >= Jan 10th

This would reset the table to look like it was last run before the given start date.

Ideally, once this is implemented, when we create a preview clone of a model we would then configure the clone to restate this latest model with the new logic.

Suggestion for resolving that is to update the SCD Type 2 logic to always go through this delete/update logic on each insert. That way in most cases where we are just processing the newest interval it would be no-op (does require a scan though) and when we have to restate it would delete/update as expected.

@eakmanrq eakmanrq added the Improvement Improves existing functionality label Jan 16, 2025
@izeigerman
Copy link
Member

izeigerman commented Jan 23, 2025

@eakmanrq how would this work if a user restates a discontinued range? Eg. if today is Jan 20th, and the user restates Jan 10th - Jan 15th

@eakmanrq
Copy link
Contributor Author

That is not allowed. So you can set start but end has to be the latest interval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Improves existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants