Skip to content

Conversation

@caitriona-cloudsmith
Copy link
Contributor

@caitriona-cloudsmith caitriona-cloudsmith commented Sep 18, 2025

If iterating over a Django queryset and iteration is broken for any reason, the connection will stay alive and be re-added to the connection pool. Upon issuing another query to Clickhouse, a PartiallyConsumedQueryError is thrown. This is raised here in the Clickhouse driver.

Commit 562a7e5b1948b1483386c7239c5d480e27d389cd demonstrates the problematic behaviour here.

This PR adds a check to the connection for is_query_executing. If this is true, the connection is not re-added to the pool and is instead disconnected.

@jayvynl jayvynl merged commit 03b9adb into jayvynl:main Sep 19, 2025
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants