phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kumar Palaniappan <kpalaniap...@marinsoftware.com>
Subject Re: Cloning a table in Phoenix
Date Fri, 09 Sep 2016 00:57:02 GMT
It's not about data. Would like to clone just the table structure(s) under the schema partially
or entire tables.


Kumar Palaniappan   

> On Sep 8, 2016, at 5:48 PM, dalin.qin <dalinqin@gmail.com> wrote:
> 
> try this:
> 
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure> CREATE TABLE TABLE1 (ID BIGINT NOT
NULL PRIMARY KEY, COL1 VARCHAR);
> No rows affected (1.287 seconds)
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure> UPSERT INTO TABLE1 (ID, COL1) VALUES
(1, 'test_row_1');
> 1 row affected (0.105 seconds)
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure> UPSERT INTO TABLE1 (ID, COL1) VALUES
(2, 'test_row_2');
> 1 row affected (0.011 seconds)
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure>  CREATE TABLE TABLE2 (ID BIGINT NOT
NULL PRIMARY KEY, COL1 VARCHAR);
> No rows affected (1.251 seconds)
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure> upsert into table2 select * from table1;
> 2 rows affected (0.049 seconds)
> 0: jdbc:phoenix:namenode:2181:/hbase-unsecure> select * from table2;
> +-----+-------------+
> | ID  |    COL1     |
> +-----+-------------+
> | 1   | test_row_1  |
> | 2   | test_row_2  |
> +-----+-------------+
> 2 rows selected (0.06 seconds)
> 
> 
>> On Thu, Sep 8, 2016 at 4:17 PM, Kumar Palaniappan <kpalaniappan@marinsoftware.com>
wrote:
>> What is an easy solution or is there a solution to clone the table/schema in phoenix?
>> 
>> Thanks in advance.
> 

Mime
View raw message