0
votes

I am copying the data into snowflake table which has three columns: ID, DATA and ETL_LOAD_TIMESTAMP.

enter image description here

I have a column ETL_LOAD_TIMESTAMP in snowflake of type TIMESTAMP_TZ(9) and I have set its default value as CURRENT_TIMESTAMP().

I get my data from a CSV file, which is of type:

ID, DATA
1, Dummy

I download the csv file at tmpdir location on local. I load the data of this csv into snowflake as:

create_cmd = "CREATE TEMPORARY STAGE teamp123 COMMENT = 'TEMPORARY STAGE FOR TEST_TABLE1 DATA LOAD'"
self.connection.execute("ALTER SESSION SET TIMEZONE = 'UTC';")
self.connection.execute(create_cmd)


self.connection.execute(f"put file://tmpdir/* @temp123 PARALLEL=8")
 
self.connection.execute("COPY INTO TEST_TABLE1 FROM @temp123 PURGE = TRUE FILE_FORMAT = (TYPE = 'CSV' field_delimiter = ',' FIELD_OPTIONALLY_ENCLOSED_BY = '\"' ESCAPE_UNENCLOSED_FIELD = None error_on_column_count_mismatch=false SKIP_HEADER = 1)")

I get the values of ID and Data but the ETL_LOAD_TIMESTAMP is null.

How do I modify this copy command so that I get the default value of ETL_LOAD_TIMESTAMP which is current timestamp instead of null?

1

1 Answers