简体   繁体   中英

[Amazon](500310) Invalid operation: syntax error at end of input Position: 684;

    CREATE EXTERNAL TABLE schema_vtvs_ai_ext.fire(
      fire_number VARCHAR(50),
      fire_year DATE,
      assessment_datetime INTEGER,
      size_class  CHAR,
      fire_location_latitude REAL,
      fire_location_longitude REAL,
      fire_origin VARCHAR(50),
      general_cause_desc VARCHAR(50),
      activity_class VARCHAR(50),
      true_cause VARCHAR(50),
      fire_start_date DATE,
      det_agent_type VARCHAR(50),
      det_agent VARCHAR(50),
      discovered_date DATE,
      reported_date DATE,
      start_for_fire_date DATE,
      fire_fighting_start_date DATE,
      initial_action_by VARCHAR(50),
      fire_type VARCHAR(50),
      fire_position_on_slope VARCHAR(50),
      weather_conditions_over_fire VARCHAR(50),
      fuel_type VARCHAR(50),
      bh_fs_date DATE,
      uc_fs_date DATE,
      ex_fs_date DATE
    );

This is the SQL code i have written to add an external table in Redhsift schema but the below error. i can't seem to see where the error is?

    [Amazon](500310) Invalid operation: syntax error at end of input  Position: 684;

If your data is in Amazon S3, then you need to specify the file format (via STORED AS) and the path to data files in S3 (via LOCATION).

This is the example query for csv files (with 1 line header):

create external table <external_schema>.<table_name> (...)
row format delimited
fields terminated by ','
stored as textfile
location 's3://mybucket/myfolder/'
table properties ('numRows'='100', 'skip.header.line.count'='1');

See official doc for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM