我正在创建一个雪花文件格式,如下所示:
create or replace file format "db_name"."schema_name".my_csv_unload_format
type = 'CSV'
field_delimiter = ',';
然后,我尝试将其添加到现有阶段:
alter stage "db_name"."schema_name".my_unloads set
file_format = (format_name = 'my_csv_unload_format');
但是在运行此查询时,我收到一个错误:
SQL compilation error: File format 'MY_CSV_UNLOAD_FORMAT' does not exist or not authorized.
我看不出我在这里做错了什么。我是否需要在某处为文件格式添加一些权限?
解决了,您还需要在格式名称中指定数据库和架构:
alter stage "db_name"."schema_name".my_unloads set
file_format = (format_name = '"db_name"."schema_name".my_csv_unload_format');
或者您可以从一开始就在创建舞台时指定file_format:
create or replace stage "db_name"."schema_name".my_unloads
file_format ='"db_name"."schema_name"."my_csv_unload_format"'
url = "..."
CREDENTIALS = (...)
;