Skip to content

Commit

Permalink
Access cursor before closing the db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
dopas21 committed May 13, 2024
1 parent 6610826 commit a6da716
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 a6da716

Please sign in to comment.