Skip to content

Commit

Permalink
chore: ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoysrt committed Oct 21, 2024
1 parent db8a406 commit 0ef1a70
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions agent/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def execute_query(self, query: str, commit: bool = False, as_dict: bool = False)
)

# Private helper methods
def _sql(self, query: str, params=(), commit: bool = False, as_dict: bool = False) -> dict | None: # noqa: C901
def _sql(self, query: str, params=(), commit: bool = False, as_dict: bool = False) -> dict | None: # noqa: C901
"""
Run sql query in database
It supports multi-line SQL queries. Each SQL Query should be terminated with `;\n`
Expand Down Expand Up @@ -106,11 +106,7 @@ def _sql(self, query: str, params=(), commit: bool = False, as_dict: bool = Fals
output = list(map(lambda x: dict(zip(columns, x)), rows))
else:
output = {"columns": columns, "data": rows}
results.append({
"query": q,
"output": output,
"row_count": row_count
})
results.append({"query": q, "output": output, "row_count": row_count})
except:
# if query execution fails, rollback the transaction and raise the error
self.db.rollback()
Expand Down

0 comments on commit 0ef1a70

Please sign in to comment.