datafold/data-diff

DB Connection is not closed automatically and close function fails

sar009 opened this issue · 0 comments

sar009 commented

Describe the bug
The established db connections are not closed automatically when the data diff is completed more over when calling for close() it throws an attribute error since super has no close function.

from data_diff import connect

uri = "redshift://user:password@host.region.redshift.amazonaws.com:5439/dev"
database = connect(url, 1)
database.close()

the code above throws the following error

AttributeError                            Traceback (most recent call last)
Cell In[8], line 1
----> 1 x.close()

File /opt/homebrew/lib/python3.11/site-packages/data_diff/databases/base.py:1214, in ThreadedDatabase.close(self)
   1213 def close(self):
-> 1214     super().close()
   1215     self._queue.shutdown()

File /opt/homebrew/lib/python3.11/site-packages/data_diff/databases/base.py:1145, in Database.close(self)
   1143 "Close connection(s) to the database instance. Querying will stop functioning."
   1144 self.is_closed = True
-> 1145 return super().close()

AttributeError: 'super' object has no attribute 'close'