If you have large amount of files from your local storage you need to load to snowflake. SnowSQL is the best way to load these files.
Steps:
Launch SnowSQL
Use Database and Schema
Create file format:
create or replace file format mycsvformat
type = 'CSV'
field_delimiter = '|'
skip_header = 1;
Create Internal Stage for loading files:
create or replace stage my_csv_stage
file_format = mycsvformat;
Upload/Stage the data files:
put file://c:\temp\load\contacts*.csv @my_csv_stage auto_compress=true;
Load files into table using Copy command:
create or replace temporary table mycsvtable (
id integer,
last_name string,
first_name string,
company string,
email string,
workphone string,
cellphone string,
streetaddress string,
city string,
postalcode string);
copy into mycsvtable
from @my_csv_stage/contacts1.csv.gz
file_format = (format_name = mycsvformat)
on_error = 'skip_file';
copy into mycsvtable
from @my_csv_stage
file_format = (format_name = mycsvformat)
pattern='.*contacts[1-4].csv.gz'
on_error = 'skip_file';
Check the contents in Table
select * from mycsvtable;
Walk through:
• Snowflake: How to load data - using S...
Documentation:
https://docs.snowflake.com/en/user-gu...