-
-
Notifications
You must be signed in to change notification settings - Fork 249
Refactor dumps code #3278
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
Refactor dumps code #3278
Conversation
Only difference is format text vs csv.
Refactor the common dump setup code of setting up zstd compression, archive creation, temporary directory management and metadata writing into two context managers: `zstd_dump` and `uncompressed_dump`.
Replaced table dicts with a `DumpTable` model and a `DumpTablesCollection` class. This helps reduce redundancy in postgres + timescale dumps and mapping dumps.
Consolidate duplicate logic for PostgreSQL and TimescaleDB dumps into a single `dump_database` function that manages the creation of public and private dumps.
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 improvement -- I like how all the details of the dump are specified in one location now. Perhaps we can do the playlist improvement at a future point in time.
|
||
archive_name = 'musicbrainz-canonical-dump-{time}'.format( | ||
time=dump_time.strftime('%Y%m%d-%H%M%S') | ||
MAPPING_TABLES = [ |
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.
ohhh, very nice!
|
||
return escaped_table_name, joined_fields | ||
PRIVATE_TABLES_TIMESCALE = DumpTablesCollection( |
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.
If could wish for one thing more that this table dumper could do, is to separate out public playlists from private playlists and put them into the dumps accordingly.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
Refactor dumps code for better readability and reducing redundancy. Individual commits explain the changes in more detail.