0% found this document useful (0 votes)
16 views1 page

Tru Cate Columns

The document shows how to copy data from an S3 bucket into a Snowflake table using the COPY command. It creates a stage, loads data from files in the stage to a table, and performs a select to view the data.

Uploaded by

clouditlab9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views1 page

Tru Cate Columns

The document shows how to copy data from an S3 bucket into a Snowflake table using the COPY command. It creates a stage, loads data from files in the stage to a table, and performs a select to view the data.

Uploaded by

clouditlab9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

---- TRUNCATECOLUMNS ----

CREATE OR REPLACE TABLE COPY_DB.PUBLIC.ORDERS (


ORDER_ID VARCHAR(30),
AMOUNT VARCHAR(30),
PROFIT INT,
QUANTITY INT,
CATEGORY VARCHAR(10),
SUBCATEGORY VARCHAR(30));

// Prepare stage object


CREATE OR REPLACE STAGE COPY_DB.PUBLIC.aws_stage_copy
url='s3://snowflakebucket-copyoption/size/';

LIST @COPY_DB.PUBLIC.aws_stage_copy;

//Load data using copy command


COPY INTO COPY_DB.PUBLIC.ORDERS
FROM @aws_stage_copy
file_format= (type = csv field_delimiter=',' skip_header=1)
pattern='.*Order.*';

COPY INTO COPY_DB.PUBLIC.ORDERS


FROM @aws_stage_copy
file_format= (type = csv field_delimiter=',' skip_header=1)
pattern='.*Order.*'
TRUNCATECOLUMNS = true;

SELECT * FROM ORDERS;

You might also like