Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions brus_backend_common/models/lakehouse_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from abc import ABC
from argparse import ArgumentTypeError
from enum import Enum
from typing import Any, Callable, Dict, List, NamedTuple
from typing import Any, Callable, Dict, List, NamedTuple, Tuple
from datetime import datetime

import deltalake
Expand Down Expand Up @@ -122,7 +122,8 @@ class LakeHouseModel(ABC):
CSV_NAME: str
FORMAT: LakeHouseModelFormat
PK: str
UNIQUE_CONSTRAINTS: List[(str,)]
# TODO: Add PK and unique constraint validations
UNIQUE_CONSTRAINTS: List[str | Tuple[str]]
MIGRATION_HISTORY: List[str] # must be ordered by earliest to latest

# The schema/structure of the delta table as StructType with StructFields
Expand Down
6 changes: 3 additions & 3 deletions brus_backend_common/models/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class DEFCGroup(CSVModel):
TABLE_NAME = "defc_mapping"
DESCRIPTION = "Internal CSV to dynamically group DEFCs together"
CSV_NAME = "DEFC_MAPPING.csv"
PK = "DEFC_CODE"
PK = "code"
UNIQUE_CONSTRAINTS = []
MIGRATION_HISTORY = []

Expand Down Expand Up @@ -174,7 +174,7 @@ class FONBronze(CSVModel):
DESCRIPTION = "Raw FON data pulled from Grants.gov"
CSV_NAME = "funding_opportunity.csv"
PK = "id"
UNIQUE_CONSTRAINTS = [""]
UNIQUE_CONSTRAINTS = ["number"]
MIGRATION_HISTORY = []

STRUCTURE = BaseSchema(
Expand All @@ -200,7 +200,7 @@ class FONGold(CSVModel):
DESCRIPTION = "Processed FON data from FONBronze"
CSV_NAME = "funding_opportunity.csv"
PK = "funding_opportunity_id"
UNIQUE_CONSTRAINTS = []
UNIQUE_CONSTRAINTS = ["funding_opportunity_number"]
MIGRATION_HISTORY = []

STRUCTURE = BaseSchema(
Expand Down
Loading