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

[Issue #1686] add created_at, updated_at, and deleted_at columns to staging tables #1894

Merged

Conversation

jamesbursa
Copy link
Collaborator

Summary

Part of #1686 (separate for easier review)

Time to review: 2 mins

Changes proposed

  • Add created_at, updated_at, and deleted_at columns to staging tables
  • Better logging of migrate queries

Context for reviewers

These columns will provide helpful metadata for understanding or troubleshooting the load process.

The created_at and updated_at columns are set automatically by SQLAlchemy.

For deleted_at, I will update #1852 after this is merged.

Additional information

Example from local testing:
Screenshot 2024-05-01 at 11 31 47

@github-actions github-actions bot added the documentation Improvements or additions to documentation label May 1, 2024
chouinar
chouinar previously approved these changes May 1, 2024
api/src/db/migrations/run.py Outdated Show resolved Hide resolved
command.downgrade(alembic_cfg, revision)


def enable_query_logging() -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Testing this, it ends up being very verbose. Is there a way we could make this configurable? Fine if its a follow-up, but locally I want to see just the alembic output, not this so much and now the logs are 3x as long

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The goal is that if there's ever a very slow migration, you can see which one it's currently processing. I'll make a follow up.

Co-authored-by: Michael Chouinard <46358556+chouinar@users.noreply.github.com>
@jamesbursa jamesbursa merged commit 355f9d3 into main May 1, 2024
8 checks passed
@jamesbursa jamesbursa deleted the jamesbursa/1686-add-created-update-deleted-at-to-staging branch May 1, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api database documentation Improvements or additions to documentation python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants