Skip to content

location_model_update_kas#122

Merged
jirhiker merged 7 commits into
pre-productionfrom
location_model_update_kas
Sep 8, 2025
Merged

location_model_update_kas#122
jirhiker merged 7 commits into
pre-productionfrom
location_model_update_kas

Conversation

@ksmuczynski

Copy link
Copy Markdown
Contributor

Why

This PR addresses the following problem / context:

  • Missing fields needed to be added to the Ocotillo models
  • Models syntax should conform to the latest type-hinting/mapping styles for SQL Alchemy 2.0
  • Association proxies should be added. They help manage many-to-many relationships and allow the user to interact with primary model objects and not the intermediary join model.

How

Implementation summary - the following was changed / added / removed:

  • Updated:
    • The Location model field syntax to conform to the latest syntax style for SQLAlchemy 2.0
    • The Location model relationship syntax to conform to the latest syntax style for SQLAlchemy 2.0
    • The relationships in the LocationThingAssociation model to reflect the use of proxies
  • Added:
    • thing_associations relationship to the Location model
    • An association proxy to the Location model.
    • Imported the association_proxy function and AssociationProxy class so proxies can be implemented
    • (TD) The following fields: nma_pk_location, nma_notes_location

Notes

Any special considerations, workarounds, or follow-up work to note?

  • schema files were not updated. The only fields that were added were fields whose purpose is to preserve information from NMAquifer.
  • test files have not been updated. I'm not sure if they need to be.

Questions
- I think the Group model needs a relationship to the Location table. Thoughts?
- In the schemas\location.py file, Should the effective_start and effective_end fields of the LocationThingAssociation be included in the UPDATE schema?
- I noticed the Thing model uses the overlaps relationship attribute. Should this be used in the Location model, too?
- I assigned the nma_pk_location field a Mapped[UUID] type attribute. Should nma_pk_tablename fields be assigned Mapped[str] or Mapped[UUID] type attributes? I think NMAquifer stored primary keys as GUIDs.

@codecov-commenter

codecov-commenter commented Sep 8, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
db/location.py 93.93% <100.00%> (+1.93%) ⬆️

Comment thread db/location.py Outdated
Comment thread db/location.py

@jirhiker jirhiker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tests failing. need to import UUID.

@jirhiker jirhiker merged commit 69e1df2 into pre-production Sep 8, 2025
3 checks passed
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.

3 participants