Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

process_new_vendor fix, part duex #2

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/connector_postgres_v2/base_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,10 @@ 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: 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)
return prep_results(cursor.fetchall())
conn.commit()
return cursor.fetchall()

return self._execute(sql, conn_str, handler)

Expand Down
Loading