Skip to content

Commit

Permalink
Merge pull request #19 from dopas21/master
Browse files Browse the repository at this point in the history
Access cursor before closing the db connection
  • Loading branch information
mergify[bot] committed May 14, 2024
2 parents 6610826 + a6da716 commit 54e5aa9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sphinxcontrib/sqltable.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def run(self):
LOG.info('Running query %r' % query)
with engine.connect() as conn:
results = conn.execute(sqlalchemy.text(query))
table_headers = results.keys()
table_body = results.fetchall()
except Exception as err:
error = self.state_machine.reporter.error(
u'Error with query %s for sqltable: %s' % (
Expand All @@ -83,8 +85,6 @@ def run(self):
return [error]

# Extract some values we need for building the table.
table_headers = results.keys()
table_body = results
max_cols = len(table_headers)

# Handle the width settings and title
Expand Down

0 comments on commit 54e5aa9

Please sign in to comment.