Skip to content

Commit

Permalink
fix(target): DDL for adding a column now uses a SQLAlchemy-compiled c…
Browse files Browse the repository at this point in the history
…lause to apply proper quoting (#2582)

compile create column clause with sqla engine to ensure proper quoting is applied

Co-authored-by: Edgar Ramírez Mondragón <[email protected]>
  • Loading branch information
haleemur and edgarrmondragon authored Aug 1, 2024
1 parent b5ed825 commit 7ccfb87
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,8 @@ def _get_column_type(

return column.type

@staticmethod
def get_column_add_ddl(
self,
table_name: str,
column_name: str,
column_type: sa.types.TypeEngine,
Expand All @@ -998,11 +998,12 @@ def get_column_add_ddl(
column_type,
),
)
compiled = create_column_clause.compile(self._engine)
return sa.DDL(
"ALTER TABLE %(table_name)s ADD COLUMN %(create_column_clause)s",
{
{ # type: ignore[arg-type]
"table_name": table_name,
"create_column_clause": create_column_clause,
"create_column_clause": compiled,
},
)

Expand Down

0 comments on commit 7ccfb87

Please sign in to comment.