Skip to content

Commit

Permalink
fix(Cursor, __has_valid_columns): replace table_schema by schema_name…
Browse files Browse the repository at this point in the history
…. resolves unknown column error seen in insert_data_bulk
  • Loading branch information
Brooke-white committed Dec 14, 2023
1 parent f8b2e0c commit b199bfa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redshift_connector/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ def insert_data_bulk(

def __has_valid_columns(self: "Cursor", table: str, columns: typing.List[str]) -> bool:
split_table_name: typing.List[str] = table.split(".")
q: str = "select 1 from information_schema.columns where table_name = ? and column_name = ?"
q: str = "select 1 from pg_catalog.svv_all_columns where table_name = ? and column_name = ?"
if len(split_table_name) == 2:
q += " and table_schema = ?"
q += " and schema_name = ?"
param_list = [[split_table_name[1], c, split_table_name[0]] for c in columns]
else:
param_list = [[split_table_name[0], c] for c in columns]
Expand Down

0 comments on commit b199bfa

Please sign in to comment.