Skip to content

Commit

Permalink
escape column names in PRIMARY KEY statement in SQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
mc51 committed Jun 16, 2023
1 parent 112ecbf commit 49c1982
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion awswrangler/redshift/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ def _create_table( # pylint: disable=too-many-locals,too-many-arguments,too-man
primary_keys=primary_keys,
)
cols_str: str = "".join([f'"{k}" {v},\n' for k, v in redshift_types.items()])[:-2]
primary_keys_str: str = f",\nPRIMARY KEY ({', '.join(primary_keys)})" if primary_keys else ""
primary_keys_str: str = (
",\nPRIMARY KEY ({})".format(", ".join('"' + pk + '"' for pk in primary_keys)) if primary_keys else ""
)
distkey_str: str = f"\nDISTKEY({distkey})" if distkey and diststyle == "KEY" else ""
sortkey_str: str = f"\n{sortstyle} SORTKEY({','.join(sortkey)})" if sortkey else ""
sql = (
Expand Down

0 comments on commit 49c1982

Please sign in to comment.