Know more about COPY INTO command (Table) in Snowflake

Опубликовано: 29 Сентябрь 2024
на канале: Knowledge Amplifier
4,732
39

Code:
---------
--drop database if required
drop database if exists ramu;
--Create Database
create database if not exists ramu;
--use the database
use ramu;
--Table Creation
create table if not exists video (sepal_length number(10,4),sepal_width number(10,4),petal_length number(10,4) ,petal_width number(10,4),class varchar(200));
--file-format creation
create or replace file format my_csv_format
type = csv field_delimiter = ',' skip_header = 1
field_optionally_enclosed_by = '"'
null_if = ('NULL', 'null')
empty_field_as_null = true;
--stage creation
create or replace stage ramu.PUBLIC.snow_simple url="s3://**************"
credentials=(aws_key_id='********************'
aws_secret_key='**************')
file_format = my_csv_format;
--check the data present in S3
list @ramu.PUBLIC.snow_simple;
--copy command
copy into ramu.PUBLIC.video from @ramu.PUBLIC.snow_simple FILE_FORMAT=(FORMAT_NAME=my_csv_format) pattern='.*[.]csv';
--Execute the query
select * from video;
truncate table video;


Learn about Snowflake & AWS services integration & many more about Big Data with Cloud Computing from the below playlist :
   • Demystifying Data Engineering with Cl...  

#snowflake