guynir42 / AstroRetriever

A package used for downloading and processing images from various astronomical surveys
Other
4 stars 2 forks source link

Smart Session #99

Closed guynir42 closed 1 year ago

guynir42 commented 1 year ago

Turn all Session() into SmartSession(). This session allows the internal scope to pick up an external session and use it and leave it open, or start an internal session that closes when done.

It also allows passing False to make a "no op" session that never touches the database. This can also be set globally using src.database.NO_DB_SESSION=True.

The regular Session() can still be called, but it would need an explicit session.begin() to be called.