pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.76k stars 297 forks source link

Fixes pudo/dataset#363 #364

Closed branchjoshua closed 3 years ago

branchjoshua commented 3 years ago

Fixes pudo/dataset#363 by tracking checked-out sqlalchemy database connections, on a per-thread basis, and closing all connections when Database.close() is called.

pudo commented 3 years ago

Hello @branchjoshua - I have to send you my apology. I looked at this PR when you sent it and somehow came to the conclusion that it was incredibly complex and needed to be studied for hours, so it fell through the cracks. Now I'm checking it again and it looks like a clean and simple solution to this issue.

I do expect that this would crash any threads that attempt to perform DB operations past the point at which close() is called, but that seems like the whole point of doing this. Let's give it a shot and see if anyone dies.