- Added .gitignore to exclude temporary folders. - Created SQL script to update existing A_WORKFLOW_HISTORY_KEY in A_SOURCE_FILE_RECEIVED. - Implemented rollback script to clear backfilled A_WORKFLOW_HISTORY_KEY values. - Added README.md for installation and usage instructions. - Developed master installation and rollback scripts for MARS-1409 post-hook. - Verified installation and rollback processes with detailed checks. - Updated trigger logic to manage workflow history updates. - Ensured proper version tracking and verification for related packages.
2.4 KiB
2.4 KiB
MARS-1409-POSTHOOK: Backfill A_WORKFLOW_HISTORY_KEY for existing records
Overview
Post-hook for MARS-1409. Backfills A_WORKFLOW_HISTORY_KEY in
CT_MRDS.A_SOURCE_FILE_RECEIVED for historical records that existed before
MARS-1409 was installed.
Matches records by SOURCE_FILE_NAME against file$name in the corresponding
ODS table (ODS.<TABLE_ID>_ODS) for each INPUT source configuration.
Contents
| File | Description |
|---|---|
install_mars1409_posthook.sql |
Master installation script (SPOOL, ACCEPT, quit) |
rollback_mars1409_posthook.sql |
Master rollback script (SPOOL, ACCEPT, quit) |
01_MARS_1409_POSTHOOK_update_existing_workflow_keys.sql |
Backfill UPDATE script |
91_MARS_1409_POSTHOOK_rollback_workflow_keys.sql |
Clear backfilled values |
track_package_versions.sql |
Universal version tracking (no packages changed) |
verify_packages_version.sql |
Universal package verification |
README.md |
This file |
Prerequisites
- MARS-1409 installed (
A_WORKFLOW_HISTORY_KEYcolumn must exist inCT_MRDS.A_SOURCE_FILE_RECEIVED) - ODS tables populated with ingested data
- ADMIN user with access to CT_MRDS and ODS schemas
Installation
# Execute as ADMIN user
Get-Content "MARS_Packages/REL02_POST/MARS-1409-POSTHOOK/install_mars1409_posthook.sql" | sql "ADMIN/Cloudpass#34@ggmichalski_high"
Log file created automatically: log/INSTALL_MARS_1409_POSTHOOK_<PDB>_<timestamp>.log
What it does
- Iterates all
INPUTsource configurations fromCT_MRDS.A_SOURCE_FILE_CONFIG - For each config, joins
A_SOURCE_FILE_RECEIVEDwithODS.<TABLE_ID>_ODSonSOURCE_FILE_NAME = file$name - Updates
A_WORKFLOW_HISTORY_KEYfor records with statuses:VALIDATED,READY_FOR_INGESTION,INGESTED,ARCHIVED,ARCHIVED_AND_TRASHED,ARCHIVED_AND_PURGED - Skips configs with no NULL records or missing ODS tables
- Prints summary with counts per config and overall totals
Rollback
# Execute as ADMIN user
Get-Content "MARS_Packages/REL02_POST/MARS-1409-POSTHOOK/rollback_mars1409_posthook.sql" | sql "ADMIN/Cloudpass#34@ggmichalski_high"
Rollback clears all non-NULL A_WORKFLOW_HISTORY_KEY values from A_SOURCE_FILE_RECEIVED.
The trigger installed by MARS-1409 will repopulate new records automatically.
Related
- MARS-1409: Add A_WORKFLOW_HISTORY_KEY column to A_SOURCE_FILE_RECEIVED (main package)