当我尝试上传到雪花中时,使用put命令和table stage得到错误

时间:2020-05-14 16:37:58

标签: snowflake-cloud-data-platform

创建表语句

create table  "DEMO_DB"."PUBLIC"."Trips"
(tripduration integer,
  starttime timestamp,
  stoptime timestamp,
  start_station_id integer,
  start_station_name string,
  start_station_latitude float,
  start_station_longitude float,
  end_station_id integer,
  end_station_name string,
  end_station_latitude float,
  end_station_longitude float,
  bikeid integer,
  usertype string,
  birth_year integer,
  gender integer);

PUT命令

avinash#COMPUTE_WH@DEMO_DB.PUBLIC>put file://C:\Users\lanreddy\Desktop\JC-202002-citibike-tripdata1.csv @%Trips;
 **002003 (02000): SQL compilation error: Stage 'DEMO_DB.PUBLIC."%TRIPS"' does not exist or not authorized.**

1 个答案:

答案 0 :(得分:0)

创建表时,您在表名周围使用双引号,这意味着它区分大小写:create table "DEMO_DB"."PUBLIC"."Trips"。这样做时,这意味着每次引用该表时,都需要将其用引号引起来(表名称为Trips而不是TRIPS或trips)

尝试使用您的PUT命令来运行它:

COMPUTE_WH@DEMO_DB.PUBLIC> put file://C:\Users\lanreddy\Desktop\JC-202002-citibike-tripdata1.csv @%"Trips";

或者这个:

COMPUTE_WH@DEMO_DB.PUBLIC> put file://C:\Users\lanreddy\Desktop\JC-202002-citibike-tripdata1.csv @"%Trips";

我建议不要创建双引号的表。如果将原始CREATE TABLE语句更改为以下内容,则原始PUT命令可能会起作用:

create table  DEMO_DB.PUBLIC.trips
(tripduration integer,
  starttime timestamp,
  stoptime timestamp,
  start_station_id integer,
  start_station_name string,
  start_station_latitude float,
  start_station_longitude float,
  end_station_id integer,
  end_station_name string,
  end_station_latitude float,
  end_station_longitude float,
  bikeid integer,
  usertype string,
  birth_year integer,
  gender integer);