-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This is a follow-up to #1794 - which it builds upon. ## Summary Fixes #1746 ### Time to review: __10 mins__ ## Changes proposed Adds transformation logic for the assistance listing (formerly CFDA) tables. ## Context for reviewers The transformations are pretty uneventful, the only complexity is that the legacy Oracle database doesn't have a foreign key between the `TopportunityCfda` table and the `Topportunity` table and there are ~2300 orphaned cfda records that we wouldn't be able to import, so we additionally need to validate that the opportunity exists when we try to transform the data, and if not, we just mark it as "transformed" and do nothing with it. There is some basic work on relationships between the staging tables + more factories for setting up the data which will be ongoing / @jamesbursa is also looking into. --------- Co-authored-by: nava-platform-bot <[email protected]>
- Loading branch information
1 parent
480f395
commit 4b73f7e
Showing
6 changed files
with
415 additions
and
8 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,10 +1,22 @@ | ||
from sqlalchemy.orm import Mapped, relationship | ||
|
||
from src.db.legacy_mixin import opportunity_mixin | ||
from src.db.models.staging.staging_base import StagingBase, StagingParamMixin | ||
|
||
|
||
class Topportunity(StagingBase, opportunity_mixin.TopportunityMixin, StagingParamMixin): | ||
__tablename__ = "topportunity" | ||
|
||
cfdas: Mapped[list["TopportunityCfda"]] = relationship( | ||
primaryjoin="Topportunity.opportunity_id == foreign(TopportunityCfda.opportunity_id)", | ||
uselist=True, | ||
) | ||
|
||
|
||
class TopportunityCfda(StagingBase, opportunity_mixin.TopportunityCfdaMixin, StagingParamMixin): | ||
__tablename__ = "topportunity_cfda" | ||
|
||
opportunity: Mapped[Topportunity | None] = relationship( | ||
primaryjoin="TopportunityCfda.opportunity_id == foreign(Topportunity.opportunity_id)", | ||
uselist=False, | ||
) |
Oops, something went wrong.