Skip to content

get_db_engine - #449

Open
mcoughlin wants to merge 3 commits into
cesium-ml:mainfrom
mcoughlin:get_db_engine
Open

get_db_engine#449
mcoughlin wants to merge 3 commits into
cesium-ml:mainfrom
mcoughlin:get_db_engine

Conversation

@mcoughlin

Copy link
Copy Markdown
Collaborator

This PR adds a get_db_engine helper function.

@mcoughlin
mcoughlin requested a review from stefanv August 4, 2026 03:40
Comment thread app/models.py Outdated
"""The SQLAlchemy engine that DBSession is bound to.

A readable accessor so callers that need a one-off sync Session can write
``Session(bind=get_db_engine())`` instead of reaching into

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. Quick q: if this really is the intent, then should we just have a utility function for providing the session?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

good point :)

@mcoughlin
mcoughlin requested a review from stefanv August 4, 2026 11:24
Comment thread app/models.py Outdated
@@ -199,6 +199,9 @@ def bulk_verify(mode, collection, accessor):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I didn't see this come in: what is RLS?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

just access control.

Comment thread app/models.py
DBSession.configure(bind=conn, autoflush=autoflush, future=True)
Base.metadata.bind = conn

global plain_session_factory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM; any race conditions to check for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

each session should be independent, so I don't think so.

@mcoughlin
mcoughlin requested a review from stefanv August 4, 2026 14:17
@mcoughlin

Copy link
Copy Markdown
Collaborator Author

@stefanv feel free to merge if you are happy with this.

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