Skip to content

How to close connection to a DuckDB backend? #6200

Answered by dimitri-b
dimitri-b asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you, I experimented with the suggestions:

  1. Using read-only mode in all connections doesn't work in this use case, as I need to use the generate -> check -> re-generate -> check -> repeat pattern, which requires a 'write' connection.
  2. Using the gc trick did not work, unfortunately.
  3. I found that conn.con.dispose() did the job, at least in this case, with both 'read-only' and default mode. I understand this reaches into the internals (SQLAlchemy backend) and uses a method that has the side effect of closing the connection.

...has the effect of fully closing all currently checked in database connections. Connections that are still checked out will not be closed, however they will no lo…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@gforsyth
Comment options

@cpcloud
Comment options

@cpcloud
Comment options

@dimitri-b
Comment options

Answer selected by dimitri-b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants