Skip to content
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

FEAT: Reset ODS tables for new QLIK Snapshot #23

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

rymarczy
Copy link
Contributor

@rymarczy rymarczy commented Sep 17, 2024

The original implementation of the ODS-QLIK RDS loader assumed that new snapshots would not be created. An assert check made sure that this condition stopped any loading operation if a new snapshot was detected.

This change loads new QLIK snapshots by totally wiping out the existing history and fact tables and loading the newest snapshot that is found.

With this implementation all transaction history will be lost any time cubic restarts the QLIK replication process.

This change requires that the application ECS be given DELETE permission for the application status files on S3.

Devops PR: https://github.com/mbta/devops/pull/2170

s3_delete_object(self.status_path)
self.etl_status = self.load_etl_status()

self.db.execute(drop_table(self.db_history_table))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't tell but are these within a db transaction. Also, do we need delete permissions for the database?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the self.db.execute call automatically creates it's own transaction, but each call is in its own transaction.

The application role should automatically have permission to drop these tables because the role also created them. That is generally standard in postgres.

@rymarczy rymarczy merged commit d1c4015 into main Sep 17, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants