Skip to content

Commit

Permalink
Feature/working memory query 281 (#287)
Browse files Browse the repository at this point in the history

* Moved the tr.start out of if block

  Fixes bug #286

---------

Co-authored-by: Christian Parker <[email protected]>
  • Loading branch information
russbiggs and caparker authored Sep 27, 2023
1 parent 75a2efd commit fd2ec69
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions openaq_api/openaq_api/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ async def fetch(self, query, kwargs, config = None):
rquery, args = render(query, **kwargs)
async with pool.acquire() as con:
try:
self.request.state.timer.mark('connected')
# a transaction is required to prevent auto-commit
# a transaction is required to prevent auto-commit
tr = con.transaction()
await tr.start()
if config is not None:
await tr.start()
for param, value in config.items():
if param in allowed_config_params:
q = f"SELECT set_config('{param}', $1, TRUE)"
Expand Down

0 comments on commit fd2ec69

Please sign in to comment.