You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Igor Tatarinov <ig...@decide.com> on 2012/03/06 01:59:20 UTC

create table LIKE for external tables?

Is there a way to create an external table LIKE another table?

This doesn't work:

CREATE TABLE B LIKE A
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE
LOCATION 's3://..';

FAILED: Parse Error: line 2:0 mismatched input 'ROW' expecting EOF

I tried creating a managed table B first and then changing its properties.
I can "make" the table external but I don't know how to change its
"location" from hdfs to s3.

I am using EMR Hive.

Thanks!

igor
decide.com

Re: create table LIKE for external tables?

Posted by Igor Tatarinov <ig...@decide.com>.
Thanks, I should have tried adding "external" before asking :)

Although, it doesn't work in EMR Hive. Table B is still 'described' as
managed so I had to run

alter table B set tblproperties('EXTERNAL'='TRUE');

along with changing the location.

Everything seems to work now!

On Mon, Mar 5, 2012 at 5:36 PM, Aniket Mokashi <an...@gmail.com> wrote:

> 1. create external table B like A;
> 2. alter table B set location 's3n://....'
>
> Thanks,
> Aniket
>
>
> On Mon, Mar 5, 2012 at 4:59 PM, Igor Tatarinov <ig...@decide.com> wrote:
>
>> Is there a way to create an external table LIKE another table?
>>
>> This doesn't work:
>>
>> CREATE TABLE B LIKE A
>> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE
>> LOCATION 's3://..';
>>
>> FAILED: Parse Error: line 2:0 mismatched input 'ROW' expecting EOF
>>
>> I tried creating a managed table B first and then changing its
>> properties. I can "make" the table external but I don't know how to change
>> its "location" from hdfs to s3.
>>
>> I am using EMR Hive.
>>
>> Thanks!
>>
>> igor
>> decide.com
>>
>>
>
>
> --
> "...:::Aniket:::... Quetzalco@tl"
>

Re: create table LIKE for external tables?

Posted by Aniket Mokashi <an...@gmail.com>.
1. create external table B like A;
2. alter table B set location 's3n://....'

Thanks,
Aniket

On Mon, Mar 5, 2012 at 4:59 PM, Igor Tatarinov <ig...@decide.com> wrote:

> Is there a way to create an external table LIKE another table?
>
> This doesn't work:
>
> CREATE TABLE B LIKE A
> ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t' STORED AS TEXTFILE
> LOCATION 's3://..';
>
> FAILED: Parse Error: line 2:0 mismatched input 'ROW' expecting EOF
>
> I tried creating a managed table B first and then changing its properties.
> I can "make" the table external but I don't know how to change its
> "location" from hdfs to s3.
>
> I am using EMR Hive.
>
> Thanks!
>
> igor
> decide.com
>
>


-- 
"...:::Aniket:::... Quetzalco@tl"