-
Notifications
You must be signed in to change notification settings - Fork 565
Add mydumper/myloader DB backup and restore support #4358
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
base: develop
Are you sure you want to change the base?
Conversation
9d7c021 to
c918fc3
Compare
Documentation Link Check Results✅ Absolute links check passed |
| "Please backup the database first." | ||
| ) | ||
|
|
||
| if not self.url.database: |
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.
We do those validations repeatedly (both on dump and restore). Some validations we do on the property level (e.g. on def backup_location. It would be good for code clarity to group those validations and execute them once at instantiation? Maybe we could pass them as a pydantic params object and handle any validations there?
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.
This is in fact guaranteed to be not null, but had to do something like this to please mypy.
schustmi
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.
Love this Pr! Only left a few small questions
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.
I like the solution and the refactoring a lot. Left some comments - non blocking - so feel free to address them at your convenience.
|
Classification template updates in |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
E2E template updates in |
Describe changes
Implements a mydumper/myloader DB backup strategy.
The mydumper/myloader DB backup strategy is far superior in terms of speed and used storage space:
Example:
Other related changes:
Implementation details
The previous
MigrationUtilsclass that held all the code required for all the available database backup strategies has been reorganized into a hierarchy of classes:BaseDatabaseBackupEngineclass defines the database backup/restore engine abstraction. It contains several common utilities such as database creation/deletion and thebackup_database,restore_databaseandcleanup_database_backupabstract methods that every backup engine has to implement.SQLAlchemyDatabaseBackupEngineis a base class that uses SQLAlchemy to dump/load data from/to the database. It is used as a base class to implement the existing DB strategies: in-memory, file-dump and database cloning. These are implemented in theInMemoryDatabaseBackupEngine,FileDatabaseBackupEngineandDBCloneDatabaseBackupEngineclasses respectively.MyDumperDatabaseBackupEngineclass that extends directly fromBaseDatabaseBackupEngineA lot of code that was spread across the SQLZenStore implementation has been moved to the base backup engine class and its implementations, so that the SQLZenStore class is no longer concerned with the backup/restore functionality.
Pre-requisites
Please ensure you have done the following:
developand the open PR is targetingdevelop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.Types of changes