datajoint / datajoint-python

Relational data pipelines for the science lab
https://datajoint.com/docs
GNU Lesser General Public License v2.1
170 stars 85 forks source link

Python context manager raises error with datajoint connection object #1081

Open yambottle opened 1 year ago

yambottle commented 1 year ago

Bug Report

Description

Datajoint connection cannot be defined with the python with, and using with is the regular way to make sure a connection is closed after dj.conn().

Reproducibility

Include:

Expected Behavior

Using with to create a datajoint db connection, and close the connection at the end of the with clause.

ethho commented 2 months ago

AFAIK, dj.Connection does not implement a context manager. So this issue is a feature request to add context manager functionality to dj.Connection, not a bug fix.