Skip to content

Commit

Permalink
Fix issue where response was an embedded json string
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog committed Dec 22, 2023
1 parent dc01e63 commit 76ffafa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/connector_postgres_v2/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _execute(self, sql: str, conn_str: str, handler: Any) -> ConnectorProxyRespo
conn.close()

command_response: CommandResponseDict = {
"body": json.dumps(command_response_body),
"body": command_response_body,
"mimetype": "application/json",
}
return_response: ConnectorProxyResponseDict = {
Expand Down Expand Up @@ -66,8 +66,8 @@ def handler(conn: Any, cursor: Any) -> None:
return self._execute(sql, conn_str, handler)

def fetchall(self, sql: str, conn_str: str, values: list) -> ConnectorProxyResponseDict:
def prep_results(results: dict) -> list:
return list(map(list, results))
def prep_results(results: list) -> list:
return list(map(lambda r: r[0][1:-1].replace('"', '').split(","), results))
def handler(conn: Any, cursor: Any) -> list:
cursor.execute(sql, values)
return prep_results(cursor.fetchall())
Expand Down

0 comments on commit 76ffafa

Please sign in to comment.