Skip to content

Commit

Permalink
fix #125: Close database connection after each query
Browse files Browse the repository at this point in the history
Each query creates a new DB connection.
This change is to close each new connection rather than leaving
them open, to allow for runs which involve large numbers of queries.
  • Loading branch information
mbhutton authored and AlexanderWillner committed Nov 10, 2024
1 parent 3c73be4 commit 56bc5f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion things/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,9 @@ def execute_query(self, sql_query, parameters=(), row_factory=None):
cursor = connection.cursor()
cursor.execute(sql_query, parameters)

return cursor.fetchall()
result = cursor.fetchall()
connection.close()
return result


# Helper functions
Expand Down

0 comments on commit 56bc5f0

Please sign in to comment.