Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-38678: Make sure database connection is correctly closed #818

Merged
merged 1 commit into from Apr 13, 2023

Conversation

andy-slac
Copy link
Contributor

In some contexts query results caused database connection to stay open until all result rows are returned from iterator. This could cause nested database connections, which failed for SQLite in SQLAlchemy 2.0 due to database being locked. This patch retrieves all rows and closes database connection before starting iteration.

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

In some context query results caused database connection to stay open until
all result rows are returned from iterator. This could cause nested
database connections, which failed for SQLite in SQLAlchemy 2.0 due to
database being locked. This patch retrieves all rows and closes database
connection before starting iteration.
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (54a215b) 87.74% compared to head (4baa283) 87.75%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #818   +/-   ##
=======================================
  Coverage   87.74%   87.75%           
=======================================
  Files         268      268           
  Lines       34930    34932    +2     
  Branches     7346     7347    +1     
=======================================
+ Hits        30651    30653    +2     
  Misses       3125     3125           
  Partials     1154     1154           
Impacted Files Coverage Δ
.../daf/butler/registry/queries/_sql_query_context.py 72.45% <100.00%> (+0.23%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@andy-slac andy-slac merged commit 220d528 into main Apr 13, 2023
13 checks passed
@andy-slac andy-slac deleted the tickets/DM-38678 branch April 13, 2023 21:48
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.

None yet

2 participants