Vishnu
Vishnu

Reputation: 11

Create hive external table with partitions

I have already an internal table in hive. Now I want to create an external table with partitions based on date to it. But it throws error, when I try to create it.

Sample code:

create external table db_1.T_DATA1 partitioned by (date string) as select * from db_2.temp
LOCATION 'file path';

Error:

ParseException line 2:0 cannot recognize input near 'LOCATION' ''file path'' '' in table source

Upvotes: 1

Views: 131

Answers (1)

Prabhakar Reddy
Prabhakar Reddy

Reputation: 5144

As per the answer provided at https://stackoverflow.com/a/26722320/4326922 you should be able to create external table with CTAS.

Upvotes: 1

Related Questions