Riccardo Lamera
Riccardo Lamera

Reputation: 105

How can I create external tables with Hive?

This is the script I run on Hive:

CREATE EXTERNAL TABLE 'people'(
    'name' string,
    'surname' string,
    'age' string)
ROW FORMAT SERDE
    'org.apache.hadoop.hive.serde2.avro.AvroSerDe'
STORED AS INPUTFORMAT
    'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat'
OUTPUTFORMAT
    'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat'
LOCATION
    'gs://directory/subdirectory/'
TBLPROPERTIES (
    'avro.schema.url'='gs://directory/schema.avsc',
    'transient_lastDdlTime'='1644235388');

I get this error: Error while compiling statement:

FAILED: ParseException line 1:22 cannot recognize input near ''people'' '(' ''nam'' in table name

Upvotes: 0

Views: 61

Answers (1)

Koushik Roy
Koushik Roy

Reputation: 7407

could you pls enclose them with backtick( `)

CREATE EXTERNAL TABLE `people`(
    `name` string,
    `surname` string,
    `age` string)
...

Upvotes: 1

Related Questions