Skip to content

Commit

Permalink
PR feedback - add comment with example
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog committed Dec 22, 2023
1 parent 59901e1 commit 7d714b3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/connector_postgres_v2/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ def handler(conn: Any, cursor: Any) -> None:

def fetchall(self, sql: str, conn_str: str, values: list) -> ConnectorProxyResponseDict:
def prep_results(results: list) -> list:
# takes the raw results which is a list of a single item list of strings that
# look like tuples with embedded quotes:
# - [["(1,\"some vendor\")"], ["(2,\"another vendor\")"]]
# and turns it into a list of lists of strings that represent the data for each
# column. this way the individual values can be accessed directly from task data.
# - [["1", "some vender"], ["2", "another_vendor"]]
return [r[0][1:-1].replace('"', '').split(",") for r in results]
def handler(conn: Any, cursor: Any) -> list:
cursor.execute(sql, values)
Expand Down

0 comments on commit 7d714b3

Please sign in to comment.