-
Notifications
You must be signed in to change notification settings - Fork 415
Fix/3047 prevent same naming for staging and final datasets #3096
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
Fix/3047 prevent same naming for staging and final datasets #3096
Conversation
…dataset (#XXXX) * Introduced `create_dataset_names` static method in `WithStagingDataset` class. * Added validation to ensure staging dataset name is not the same as the final dataset name, raising a ValueError if they match. * Updated documentation for the new method and error handling.
…saging and add unit tests * Reformatted the `create_dataset_names` method for better readability. * Improved error messages to clarify the consequences of identical dataset names. * Added unit tests for `create_dataset_names` to validate functionality and error handling.
* Replaced direct calls to `normalize_dataset_name` and `normalize_staging_dataset_name` with a new method `create_dataset_names` in multiple destination client classes. * This change improves consistency in dataset name generation across various implementations, ensuring proper handling of dataset names and staging datasets.
…nts in destination clients * Updated dataset name assignments in multiple destination client classes to enhance readability by breaking long lines. * Maintained consistency in the use of the `create_dataset_names` method across implementations.
…nts in destination clients * Updated dataset name assignments in multiple destination client classes to enhance readability by breaking long lines. * Maintained consistency in the use of the `create_dataset_names` method across implementations.
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
sh-rp
left a comment
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.
Very good PR, thank you! I have one comment not related to the code, you can merge this as is and do a follow up PR or integrate into this one:
On the page you reference in the exception: https://dlthub.com/docs/dlt-ecosystem/staging#staging-dataset, we should add a sentence that staging and final datasets need to have separate names, similar to what you have written in the exception.
* disable most tests * try correct windows command for runnig marimo e2e tests * try without timeout * test only launch marimo * bump python version * try install playwright deps * fix e2e tests for dashboard on windows * enable e2e tests for dashboard * test macos 14 for dashboard e2e tests * add basic tests for ui elements * improve ui elements tests * revert changes to main github workflow * review fixes --------- Co-authored-by: Your Name <[email protected]>
* add code to fix behavior of normalizer when None or primitives are encountered for child tables (cherry picked from commit 5f44278) * fixes one existing test that would not work with cached schema otherwise * add tests and small fixes to dashboard * fix implementation and add more tests * Long names handled, get_nested_tables test, cached table lookups * relational normalizer returns unshortened parent bath * Schema contract test added --------- Co-authored-by: anuunchin <[email protected]>
Added important notes and examples to the staging dataset configuration section, emphasizing the need for unique names between staging and final datasets to avoid `ValueError` and potential data loss during setup commands.
…ng-for-staging-and-final-datasets
Description
Created
create_dataset_namesstatic method and added validation to prevent a setup where final and staging datasets have the same name.Changes:
WithStagingDataset.create_dataset_names()as a@staticmethodValueErrorwhen dataset names are equalWhy this change:
As mentioned in ticket-3047, the user has the ability to setup the staging dataset which could end up with the same name as the final dataset. A validation was added to ensure that a 'ValueError' gets raised when the stage dataset and final dataset have the same name otherwise a tuple is returned containing the data set name and the staging data set name.
Related Issues
ticket-3047
Additional Context
This change prevents potential data loss scenarios where users might accidentally configure staging and final dataset names to be identical. The validation ensures that setup commands that should only truncate staging datasets don't accidentally truncate the final dataset.