Skip to content

feat: db models and entities#35

Merged
AlexAxthelm merged 1 commit intouse-ogsi-modelfrom
ogsi-db-models
Mar 6, 2026
Merged

feat: db models and entities#35
AlexAxthelm merged 1 commit intouse-ogsi-modelfrom
ogsi-db-models

Conversation

@mbarlow12
Copy link
Contributor

Remove source db model and integrate into OilGasFieldSourceModel (the new "source" table).

  • memberships now have a proper foreign key constraint on og_field_souces
    • Future TODO: worth noting that we can definitely hide a lot more of the membership mechanics with a "join through" relationship to get a cleaner mapping between "ResourceModel" -> "OilGasFieldSourceModel"
  • entities are almost entirely gone in favor of the stitch-ogsi pydantic models (usage in follow-ups)

I opted to keep "Resourced" declared in stitch-api for now. I wasn't sure how we want to go for getting the flat/view like version of an "OilGasFieldResource". I see 2 initial options:

  • construct the view pydantic model ephemerally using existing "resources" table: get resource w/ source data -> call to coalesce/selection module -> flattened view object
    • for this, we'd probably want to add a OGFieldResouceBase to stitch-ogsi that doesn't have the OilGasFieldBase columns
  • have an actual db artifact (table or view)
    • we can add all the OilGasFieldBase columns onto the current resources table. then we can use stitch.ogsi.model.OGFieldResource without any other manipulation

foreign key, use stitch.ogsi.models for entities
Base automatically changed from tweak-member-pkgs to use-ogsi-model March 6, 2026 08:31
type_adapter: ClassVar[TypeAdapter[OGFieldSource]] = TypeAdapter(OGFieldSource)

__tablename__ = "oil_gas_field_source"
__tablename__ = "oil_gas_field_sources"
Copy link
Collaborator

Choose a reason for hiding this comment

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

NB: For DB stuff I prefer singular over plural phrasings (old habit dies hard).

@AlexAxthelm AlexAxthelm merged commit f6872fc into use-ogsi-model Mar 6, 2026
@AlexAxthelm AlexAxthelm deleted the ogsi-db-models branch March 6, 2026 08:57
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