0
votes

How can I truncate the column data when it's size is greater than the column size while loading it into a Snowflake table. I am using file format to do COPY INTO as follows:

CREATE OR REPLACE FILE FORMAT 'schema."csv_file_format"'
                  TYPE = 'csv'
                  FIELD_DELIMITER = '\001'
                  NULL_IF = ('\\N', 'NULL', 'NUL', '')
                  COMPRESSION = 'AUTO';

COPY INTO schema.table_name
FROM @EXTERNAL_STAGE/s3_prefix
FILE_FORMAT = 'schema."csv_file_format"' ON_ERROR = 'CONTINUE' PURGE = TRUE;
2

2 Answers

1
votes
1
votes

For CSV files Snowflake provides column ordering, column omission using SELECT statement and setting TRUNCATECOLUMS=true|false in COPY command.

For more information refer Transforming Data during dataload