Reputation: 35
Following the steps in the documentation I created a stage and a file format in Snowflake, then staged a csv file with PUT
USE IA;
CREATE OR REPLACE STAGE csv_format_2;
CREATE OR REPLACE FILE FORMAT csvcol26 type='csv' field_delimiter='|';
PUT file://H:\\CSV_SWF_file_format_stage.csv @IA.public.csv_format_2
When I tried to query the staged object
SELECT a.$1 FROM @csv_format_2 (FORMAT=>'csvcol26', PATTERN=>'CSV_SWF_file_format_stage.csv.gz') a
I got: SQL Error [2] [0A000]: Unsupported feature 'TABLE'.
Any idea on this error?
Upvotes: 2
Views: 8913
Reputation: 175556
The first argument should be FILE_FORMAT
instead of FORMAT
:
SELECT a.$1
FROM @csv_format_2 (FILE_FORMAT=>'csvcol26',PATTERN=>'CSV_SWF_file_format_stage.csv.gz') a;
Related: Querying Data in Staged Files
Query staged data files using a SELECT statement with the following syntax:
SELECT [<alias>.]$<file_col_num>[.<element>] [ , [<alias>.]$<file_col_num>[.<element>] , ... ] FROM { <internal_location> | <external_location> } [ ( FILE_FORMAT => '<namespace>.<named_file_format>', PATTERN => '<regex_pattern>' ) ] [ <alias> ]
Upvotes: 2