-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: Handle NULL values in Key columns for Update operation (#36)
This change joins Primary Key columns using IS NOT DISTINCT FROM instead of = to allow for the JOINING of NULL to NULL values in Key columns. This change also contains a migration that deletes the ELT Status files for all tables loaded since PR #34 so that those tables will be re-loaded with the new loading process.
- Loading branch information
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/alembic/versions/007_96837b10c106_reset_qlik_null_key_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""reset qlik tables with possible null primary key values | ||
Revision ID: 96837b10c106 | ||
Revises: 8638e949eea1 | ||
Create Date: 2021-01-07 19:42:12.287594 | ||
""" | ||
|
||
import os | ||
from typing import Sequence, Union | ||
|
||
from cubic_loader.utils.aws import s3_delete_object | ||
from cubic_loader.utils.remote_locations import ODS_STATUS | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "96837b10c106" | ||
down_revision: Union[str, None] = "8638e949eea1" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
# Delete status files for all tables loaded since the NOT NULL Primary Key requirement was dropped. | ||
# This will force a reset/re-load for these tables in dmap-import DB | ||
s3_delete_object(os.path.join(ODS_STATUS, "EDW.PAYMENT_SUMMARY.json")) | ||
s3_delete_object(os.path.join(ODS_STATUS, "EDW.MEMBER_DIMENSION.json")) | ||
|
||
|
||
def downgrade() -> None: | ||
# Nothing to downgrade | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters