From 99e4957c952393f59fdb43d61ae9fbda0b958d4a Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Thu, 25 Jan 2024 13:32:36 -0500 Subject: [PATCH 1/2] Revert the string parsing, issue a commit --- src/connector_postgres_v2/base_command.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/connector_postgres_v2/base_command.py b/src/connector_postgres_v2/base_command.py index deac35d..1f05f1b 100644 --- a/src/connector_postgres_v2/base_command.py +++ b/src/connector_postgres_v2/base_command.py @@ -66,15 +66,10 @@ 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] + return [list(result) for result in results] def handler(conn: Any, cursor: Any) -> list: cursor.execute(sql, values) + conn.commit() return prep_results(cursor.fetchall()) return self._execute(sql, conn_str, handler) From cb19b00feeb3aeec63dc77e8ce6f799dc416d355 Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Thu, 25 Jan 2024 13:35:49 -0500 Subject: [PATCH 2/2] Remove redundant function --- src/connector_postgres_v2/base_command.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/connector_postgres_v2/base_command.py b/src/connector_postgres_v2/base_command.py index 1f05f1b..72395cf 100644 --- a/src/connector_postgres_v2/base_command.py +++ b/src/connector_postgres_v2/base_command.py @@ -65,12 +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: - return [list(result) for result in results] def handler(conn: Any, cursor: Any) -> list: cursor.execute(sql, values) conn.commit() - return prep_results(cursor.fetchall()) + return cursor.fetchall() return self._execute(sql, conn_str, handler)