execute() seems to not close the DB connection properly
See original GitHub issueSpecifically, when executing Count queries on views:
q = 'SELECT count(*) AS count_1 FROM view_xyz123'
eng = sa.Engine('psql_settings`) # connect to a Postgresql db
result = eng.execute(sa.text(q))
Despite close_with_result
always being set to True
in execute()
, I am seeing open connections stack up in PSQL when running this repeatedly.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Closing database connections in Java - Stack Overflow
When you are done with using your Connection , you need to explicitly close it by calling its close() method in order to...
Read more >database connections not closing.... - MSDN - Microsoft
Question. I'm having some problems with connections to an SQL database not closing after being opened, which is maxxing out the pool and ......
Read more >Common Reasons Why Connections Stay Open for a Long ...
Applications Not Properly Closing Connections; Long Database Queries; Shared Connections with Local Transaction Containment; Embedded getConnection Requests.
Read more >What will happen if we do not close the connection object in ...
If the database sever grants all of them, and after their usage they are not closed, the database server would not be able...
Read more >Oracle JDBC connection cannot be closed properly
I encountered a problem that Oracle JDBC connection cannot be close properly after "java.sql.SQLException: Io exception: Read timed out" is ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@zzzeek Just wanted to thank you very much for your help, especially as this wasn’t necessarily a proper bug.
turn off pooling as documented at https://docs.sqlalchemy.org/en/13/core/pooling.html#switching-pool-implementations