Is it possible to load parquet file directly into a snowflake? If yes - how?
Thanks.
Yes it is possible, and best done via S3. Note, the following assumes you have a MY_PARQUET_LOADER table, a STAGE_SCHEMA schema and an S3STAGE defined, and that your parquet files are on the bucket under the /path/ key/folder.
copy into STAGE_SCHEMA.MY_PARQUET_LOADER
from (
select
$1
,metadata$filename as metadata_filename
,metadata$file_row_number as metadata_file_row_number
,current_timestamp() as load_timestamp
from
@S3STAGE/path/)
pattern = '.*.parquet'
file_format = (
TYPE = 'PARQUET'
SNAPPY_COMPRESSION = TRUE )
ON_ERROR = 'SKIP_FILE_1%'
purge= TRUE;
where this exists:
create or replace TABLE MY_PARQUET_LOADER (
RAW VARIANT,
METADATA_FILENAME VARCHAR(16777216),
METADATA_FILE_ROW_NUMBER NUMBER(38,0),
LOAD_TIMESTAMP TIMESTAMP_LTZ(9)
) cluster by (METADATA_FILENAME);
Worthwhile to read the fine manual:
https://docs.snowflake.net/manuals/sql-reference/sql/copy-into-table.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With