Skip to content

Commit

Permalink
remove irrelevant code
Browse files Browse the repository at this point in the history
  • Loading branch information
spicy-sauce committed Nov 29, 2023
1 parent 84c88a0 commit c6ee0ba
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions core/src/datayoga_core/blocks/relational/write/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,7 @@ def generate_upsert_stmt(self) -> Any:
", ".join([f'target."{column}" = {sa.bindparam(column)}' for column in self.mapping_columns])
))

if self.db_type == relational_utils.DbType.DB2:
return sa.sql.text("""
MERGE INTO %s AS target
USING (VALUES (%s)) AS source (%s)
ON (%s)
WHEN NOT MATCHED THEN INSERT (%s) VALUES (%s)
WHEN MATCHED THEN UPDATE SET %s
""" % (
relational_utils.construct_table_reference(self.tbl),
", ".join([f"{sa.bindparam(column)}" for column in self.business_key_columns]),
", ".join([f"{column}" for column in self.business_key_columns]),
" AND ".join([f'target."{column}" = source."{column}"' for column in self.business_key_columns]),
", ".join([f'"{column}"' for column in self.columns]),
", ".join([f"{sa.bindparam(column)}" for column in self.columns]),
", ".join([f'target."{column}" = {sa.bindparam(column)}' for column in self.mapping_columns])
))


def execute(self, statement: Any, records: List[Dict[str, Any]]):
try:
Expand Down

0 comments on commit c6ee0ba

Please sign in to comment.