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 #1744] Setup staging tables for Oracle data load #1840

Merged
merged 10 commits into from
Apr 25, 2024

Conversation

chouinar
Copy link
Collaborator

Summary

Fixes #1744

Time to review: 10 mins

Changes proposed

Setup staging tables for the data ingestion process from Oracle

Modified the foreign tables to instead pull in columns from a mixin (that we reuse for the staging tables)

Context for reviewers

I built this by literally copying the existing foreign tables, and fixing the class name/definitions. The column order should be unmodified, and the columns themselves unmodified (One exception is commented below).

Additional information

I setup a factory for the staging topportunity table (more will be added as needed) just to confirm we can interact with it. Can easily test by running make console and then running commands like f.StagingTopportunityFactory(opportunity_id=100, already_transformed=True)

Comment on lines 25 to 26
created_date: Mapped[datetime.datetime | None]
last_upd_date: Mapped[datetime.datetime | None]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jamesbursa This was the only modification I made to the columns, these need to be nullable. Other tables already have these fields nullable, so this just follows the same pattern.

The last update date being null is expected, they only set it to null once it has at least one update. Create date being null seems like a bug, but I found 10 cases in the prod data where it happens

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 25, 2024
jamesbursa
jamesbursa previously approved these changes Apr 25, 2024
Copy link
Collaborator

@jamesbursa jamesbursa left a comment

Choose a reason for hiding this comment

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

Looks good, minor suggestions.

import datetime

from sqlalchemy.orm import Mapped, mapped_column
import src.db.legacy_mixins.forecast_mixin as forecast_mixin
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can shorten to:

Suggested change
import src.db.legacy_mixins.forecast_mixin as forecast_mixin
from src.db.legacy_mixins import forecast_mixin

api/src/db/foreign/opportunity.py Outdated Show resolved Hide resolved
api/src/db/foreign/synopsis.py Outdated Show resolved Hide resolved
api/src/db/legacy_mixins/forecast_mixin.py Outdated Show resolved Hide resolved
api/src/db/models/staging/synopsis.py Outdated Show resolved Hide resolved
api/src/db/models/staging/forecast.py Outdated Show resolved Hide resolved
api/src/db/models/staging/opportunity.py Outdated Show resolved Hide resolved
@chouinar chouinar merged commit 897e03e into main Apr 25, 2024
8 checks passed
@chouinar chouinar deleted the chouinar/1744-setup-staging-tables branch April 25, 2024 21:27
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.

[Task]: Setup additional transfer tables for each Oracle table
3 participants