This is an automated email from the ASF dual-hosted git repository.

eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 145b16caaa Fix S3ToRedshiftOperator does not support default values on 
UPSERT (#32558)
145b16caaa is described below

commit 145b16caaa43f0c42bffd97344df916c602cddde
Author: David <[email protected]>
AuthorDate: Thu Jul 13 02:29:07 2023 -0400

    Fix S3ToRedshiftOperator does not support default values on UPSERT (#32558)
    
    Co-authored-by: eladkal <[email protected]>
---
 airflow/providers/amazon/aws/transfers/s3_to_redshift.py    | 2 +-
 tests/providers/amazon/aws/transfers/test_s3_to_redshift.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py 
b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
index b42b2d8cbb..b80b5bed32 100644
--- a/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
+++ b/airflow/providers/amazon/aws/transfers/s3_to_redshift.py
@@ -178,7 +178,7 @@ class S3ToRedshiftOperator(BaseOperator):
             where_statement = " AND ".join([f"{self.table}.{k} = 
{copy_destination}.{k}" for k in keys])
 
             sql = [
-                f"CREATE TABLE {copy_destination} (LIKE {destination});",
+                f"CREATE TABLE {copy_destination} (LIKE {destination} 
INCLUDING DEFAULTS);",
                 copy_statement,
                 "BEGIN;",
                 f"DELETE FROM {destination} USING {copy_destination} WHERE 
{where_statement};",
diff --git a/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py 
b/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
index f73acf661e..dff441f0a6 100644
--- a/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
+++ b/tests/providers/amazon/aws/transfers/test_s3_to_redshift.py
@@ -222,7 +222,7 @@ class TestS3ToRedshiftTransfer:
                         ;
                      """
         transaction = f"""
-                    CREATE TABLE #{table} (LIKE {schema}.{table});
+                    CREATE TABLE #{table} (LIKE {schema}.{table} INCLUDING 
DEFAULTS);
                     {copy_statement}
                     BEGIN;
                     DELETE FROM {schema}.{table} USING #{table} WHERE 
{table}.id = #{table}.id;

Reply via email to