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

Refactor db layer to access results in a consistent way #137

Merged
merged 8 commits into from
Jan 3, 2024
Merged

Conversation

PGijsbers
Copy link
Contributor

SQLAlchemy provides a number of ways to fetch results from the database. While developing new endpoints, I am slowly learning how to use the various methods better. This is refactor refactors some old implementations to make them more consistent with my latest understanding of how to use SQLAlchemy core. It's likely this still isn't ideal, but it's better and the returned results will also be more similar to ORM objects which would be used in the future (e.g., attribute access instead of key access).

Closes #106

This allows for attribute access instead of mapping-style access.
The latter more closely resembles how we will later interact with
the ORM objects.
To make attribute access possible, which will be more similar
when we do switch over to ORM
Since we are selecting based on the primary key
we should always get at most one result.
@PGijsbers PGijsbers merged commit 99b5376 into main Jan 3, 2024
3 checks passed
@PGijsbers PGijsbers deleted the refactor/db branch January 3, 2024 14:54
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.

Get mapping objects directly through rows.mappings()
1 participant