将 Snowflake table 数据以 Parquet 格式卸载到 S3

Unloading Snowflake table data into S3 in Parquet format

我正在尝试将 Snowflake 故事数据以 parquet 格式卸载到 S3 存储桶中。但低于错误。

`SQL compilation error: COPY statement only supports simple SELECT from stage statements for import.`

下面是复制语句的语法

`create or replace stage STG_LOAD
url='s3://bucket/foler'
credentials=(aws_key_id='xxxx',aws_secret_key='xxxx')
file_format = (type = PARQUET);

copy into STG_LOAD from
(select OBJECT_CONSTRUCT(country_cd,source)
 from table_1 
file_format = (type='parquet')
header='true';`

如果我遗漏了什么,请告诉我。

您必须使用@ 符号来识别命名阶段。另外 header 选项是 true 而不是 'true'

copy into @STG_LOAD from
(select OBJECT_CONSTRUCT(country_cd,source)
 from table_1 )
file_format = (type='parquet')
header=true;