Re: Cloning a table in Phoenix

2016-09-09 Thread Kumar Palaniappan
Will do James.

On Fri, Sep 9, 2016 at 10:27 AM, James Taylor 
wrote:

> Good idea - this would make a great contribution. Please file a JIRA.
>
> On Fri, Sep 9, 2016 at 6:29 AM, Kumar Palaniappan <
> kpalaniap...@marinsoftware.com> wrote:
>
>> Yes James.
>>
>> Kumar Palaniappan 
>> 
>>  [image: Description: Macintosh HD:Users:Kumarappan:Desktop:linkedin.gif]
>> 
>>
>> On Sep 9, 2016, at 12:53 AM, Heather, James (ELS-LON) <
>> james.heat...@elsevier.com> wrote:
>>
>> This does rather suggest that it would be fairly easy to implement a SHOW
>> CREATE TABLE statement. Is that right?
>>
>> It would be useful if so.
>>
>> James
>>
>> On 9 September 2016 2:43:51 a.m. "dalin.qin"  wrote:
>>
>>> Hi Kumar,
>>>
>>> I believe right now there is no way to directly generate the DDL
>>> statement for the existing table,better to write down you sql immedately
>>> after exection  (in oracle ,dbms_metadata is so perfect ,in hive show
>>> create table also works )
>>> however you can query system.catalog for all the information you need .
>>>
>>> ++--+-+-
>>> ---++---+--+
>>> +-+-+---
>>> +--+-++-+
>>> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME |
>>> DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  |
>>> DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  |
>>> SQL_DATA_TYPE  | SQL_DAT |
>>> ++--+-+-
>>> ---++---+--+
>>> +-+-+---
>>> +--+-++-+
>>> || SYSTEM   | CATALOG | TENANT_ID  |
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | TABLE_SCHEM|
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | TABLE_NAME |
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 0 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | COLUMN_NAME|
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | COLUMN_FAMILY  |
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | TABLE_SEQ_NUM  |
>>> -5 | BIGINT| null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | TABLE_TYPE |
>>> 1  | CHAR  | 1| null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | PK_NAME|
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | COLUMN_COUNT   |
>>> 4  | INTEGER   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | SALT_BUCKETS   |
>>> 4  | INTEGER   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | DATA_TABLE_NAME|
>>> 12 | VARCHAR   | null | null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | INDEX_STATE|
>>> 1  | CHAR  | 1| null   | null
>>>  | null| 1 |  | | null
>>>   | null|
>>> || SYSTEM   | CATALOG | IMMUTABLE_ROWS   

Re: Cloning a table in Phoenix

2016-09-09 Thread James Taylor
Good idea - this would make a great contribution. Please file a JIRA.

On Fri, Sep 9, 2016 at 6:29 AM, Kumar Palaniappan <
kpalaniap...@marinsoftware.com> wrote:

> Yes James.
>
> Kumar Palaniappan 
> 
>  [image: Description: Macintosh HD:Users:Kumarappan:Desktop:linkedin.gif]
> 
>
> On Sep 9, 2016, at 12:53 AM, Heather, James (ELS-LON) <
> james.heat...@elsevier.com> wrote:
>
> This does rather suggest that it would be fairly easy to implement a SHOW
> CREATE TABLE statement. Is that right?
>
> It would be useful if so.
>
> James
>
> On 9 September 2016 2:43:51 a.m. "dalin.qin"  wrote:
>
>> Hi Kumar,
>>
>> I believe right now there is no way to directly generate the DDL
>> statement for the existing table,better to write down you sql immedately
>> after exection  (in oracle ,dbms_metadata is so perfect ,in hive show
>> create table also works )
>> however you can query system.catalog for all the information you need .
>>
>> ++--+-+-
>> ---++---+--+
>> +-+-+---
>> +--+-++-+
>> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME |
>> DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  |
>> DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  |
>> SQL_DATA_TYPE  | SQL_DAT |
>> ++--+-+-
>> ---++---+--+
>> +-+-+---
>> +--+-++-+
>> || SYSTEM   | CATALOG | TENANT_ID  |
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | TABLE_SCHEM|
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | TABLE_NAME |
>> 12 | VARCHAR   | null | null   | null
>>  | null| 0 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | COLUMN_NAME|
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | COLUMN_FAMILY  |
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | TABLE_SEQ_NUM  |
>> -5 | BIGINT| null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | TABLE_TYPE |
>> 1  | CHAR  | 1| null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | PK_NAME|
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | COLUMN_COUNT   |
>> 4  | INTEGER   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | SALT_BUCKETS   |
>> 4  | INTEGER   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | DATA_TABLE_NAME|
>> 12 | VARCHAR   | null | null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | INDEX_STATE|
>> 1  | CHAR  | 1| null   | null
>>  | null| 1 |  | | null
>>   | null|
>> || SYSTEM   | CATALOG | IMMUTABLE_ROWS |
>> 16 | BOOLEAN   | null | null   | null
>>  | null| 1 |  | | null
>>   | null 

Re: Cloning a table in Phoenix

2016-09-09 Thread Kumar Palaniappan
Yes James.

Kumar Palaniappan   

> On Sep 9, 2016, at 12:53 AM, Heather, James (ELS-LON) 
>  wrote:
> 
> This does rather suggest that it would be fairly easy to implement a SHOW 
> CREATE TABLE statement. Is that right?
> 
> It would be useful if so.
> 
> James
> 
>> On 9 September 2016 2:43:51 a.m. "dalin.qin"  wrote:
>> 
>> Hi Kumar,
>> 
>> I believe right now there is no way to directly generate the DDL statement 
>> for the existing table,better to write down you sql immedately after 
>> exection  (in oracle ,dbms_metadata is so perfect ,in hive show create table 
>> also works )
>> however you can query system.catalog for all the information you need .
>> 
>> ++--+-+++---+--++-+-+---+--+-++-+
>> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME | 
>> DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  | 
>> DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  | 
>> SQL_DATA_TYPE  | SQL_DAT |
>> ++--+-+++---+--++-+-+---+--+-++-+
>> || SYSTEM   | CATALOG | TENANT_ID  | 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_SCHEM| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_NAME | 12  
>>| VARCHAR   | null | null   | null
>> | null| 0 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_FAMILY  | 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_SEQ_NUM  | -5  
>>| BIGINT| null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_TYPE | 1   
>>| CHAR  | 1| null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | PK_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_COUNT   | 4   
>>| INTEGER   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | SALT_BUCKETS   | 4   
>>| INTEGER   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | DATA_TABLE_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | INDEX_STATE| 1   
>>| CHAR  | 1| null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | IMMUTABLE_ROWS | 16  
>>| BOOLEAN   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | VIEW_STATEMENT | 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | DEF

Re: Cloning a table in Phoenix

2016-09-09 Thread Heather, James (ELS-LON)
This does rather suggest that it would be fairly easy to implement a SHOW 
CREATE TABLE statement. Is that right?

It would be useful if so.

James

On 9 September 2016 2:43:51 a.m. "dalin.qin"  wrote:

Hi Kumar,

I believe right now there is no way to directly generate the DDL statement for 
the existing table,better to write down you sql immedately after exection  (in 
oracle ,dbms_metadata is so perfect ,in hive show create table also works )
however you can query system.catalog for all the information you need .

++--+-+++---+--++-+-+---+--+-++-+
| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME | 
DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  | DECIMAL_DIGITS 
 | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  | SQL_DATA_TYPE  | 
SQL_DAT |
++--+-+++---+--++-+-+---+--+-++-+
|| SYSTEM   | CATALOG | TENANT_ID  | 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | TABLE_SCHEM| 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | TABLE_NAME | 12 
| VARCHAR   | null | null   | null| 
null| 0 |  | | null   | null
|
|| SYSTEM   | CATALOG | COLUMN_NAME| 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | COLUMN_FAMILY  | 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | TABLE_SEQ_NUM  | -5 
| BIGINT| null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | TABLE_TYPE | 1  
| CHAR  | 1| null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | PK_NAME| 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | COLUMN_COUNT   | 4  
| INTEGER   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | SALT_BUCKETS   | 4  
| INTEGER   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | DATA_TABLE_NAME| 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | INDEX_STATE| 1  
| CHAR  | 1| null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | IMMUTABLE_ROWS | 16 
| BOOLEAN   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | VIEW_STATEMENT | 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | DEFAULT_COLUMN_FAMILY  | 12 
| VARCHAR   | null | null   | null| 
null| 1 |  | | null   | null
|
|| SYSTEM   | CATALOG | DISABLE_WAL| 16 
| BOOLEAN   | null | null   | null 

Re: Cloning a table in Phoenix

2016-09-08 Thread Jonathan Leech
I think you're best off running DDL with a new table name, but you could 
probably upsert the values yourself into system.catalog. If you have a lot of 
data to copy, you can use hbase snapshots and restore into the new table name. 
This would also take care of creating the underlying hbase table, index table 
if applicable etc. Things to double check are the value in the system.sequence 
table for the local indexes, and the corresponding values in system.catalog for 
local indexes. These need to match the rows for the original table if you copy 
the index data via hbase snapshots, CopyTable, etc. Otherwise queries using the 
index could return bad results until it is rebuilt. This also applies to hbase 
replication of indexes of the same Phoenix table between environments.

- Jonathan

> On Sep 8, 2016, at 8:12 PM, Kumar Palaniappan 
>  wrote:
> 
> Yes, we found a way to do off of system.catalog
> 
> In the meantime, trying to to explore are there any off the
> shelves options.
> 
> Thanks dalin.
> 
> Kumar Palaniappan   
> 
>> On Sep 8, 2016, at 6:43 PM, dalin.qin  wrote:
>> 
>> Hi Kumar,
>> 
>> I believe right now there is no way to directly generate the DDL statement 
>> for the existing table,better to write down you sql immedately after 
>> exection  (in oracle ,dbms_metadata is so perfect ,in hive show create table 
>> also works )
>> however you can query system.catalog for all the information you need .
>> 
>> ++--+-+++---+--++-+-+---+--+-++-+
>> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME | 
>> DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  | 
>> DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  | 
>> SQL_DATA_TYPE  | SQL_DAT |
>> ++--+-+++---+--++-+-+---+--+-++-+
>> || SYSTEM   | CATALOG | TENANT_ID  | 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_SCHEM| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_NAME | 12  
>>| VARCHAR   | null | null   | null
>> | null| 0 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_FAMILY  | 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_SEQ_NUM  | -5  
>>| BIGINT| null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | TABLE_TYPE | 1   
>>| CHAR  | 1| null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | PK_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | COLUMN_COUNT   | 4   
>>| INTEGER   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | SALT_BUCKETS   | 4   
>>| INTEGER   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG | DATA_TABLE_NAME| 12  
>>| VARCHAR   | null | null   | null
>> | null| 1 |  | | null   | 
>> null|
>> || SYSTEM   | CATALOG 

Re: Cloning a table in Phoenix

2016-09-08 Thread Kumar Palaniappan
Yes, we found a way to do off of system.catalog

In the meantime, trying to to explore are there any off the
shelves options.

Thanks dalin.

Kumar Palaniappan   

> On Sep 8, 2016, at 6:43 PM, dalin.qin  wrote:
> 
> Hi Kumar,
> 
> I believe right now there is no way to directly generate the DDL statement 
> for the existing table,better to write down you sql immedately after exection 
>  (in oracle ,dbms_metadata is so perfect ,in hive show create table also 
> works )
> however you can query system.catalog for all the information you need .
> 
> ++--+-+++---+--++-+-+---+--+-++-+
> | TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME | 
> DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  | 
> DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  | 
> SQL_DATA_TYPE  | SQL_DAT |
> ++--+-+++---+--++-+-+---+--+-++-+
> || SYSTEM   | CATALOG | TENANT_ID  | 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | TABLE_SCHEM| 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | TABLE_NAME | 12   
>   | VARCHAR   | null | null   | null| 
> null| 0 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | COLUMN_NAME| 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | COLUMN_FAMILY  | 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | TABLE_SEQ_NUM  | -5   
>   | BIGINT| null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | TABLE_TYPE | 1
>   | CHAR  | 1| null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | PK_NAME| 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | COLUMN_COUNT   | 4
>   | INTEGER   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | SALT_BUCKETS   | 4
>   | INTEGER   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | DATA_TABLE_NAME| 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | INDEX_STATE| 1
>   | CHAR  | 1| null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | IMMUTABLE_ROWS | 16   
>   | BOOLEAN   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | VIEW_STATEMENT | 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null   | null  
>   |
> || SYSTEM   | CATALOG | DEFAULT_COLUMN_FAMILY  | 12   
>   | VARCHAR   | null | null   | null| 
> null| 1 |  | | null 

Re: Cloning a table in Phoenix

2016-09-08 Thread dalin.qin
Hi Kumar,

I believe right now there is no way to directly generate the DDL statement
for the existing table,better to write down you sql immedately after
exection  (in oracle ,dbms_metadata is so perfect ,in hive show create
table also works )
however you can query system.catalog for all the information you need .

++--+-+++---+--++-+-+---+--+-++-+
| TABLE_CAT  | TABLE_SCHEM  | TABLE_NAME  |COLUMN_NAME |
DATA_TYPE  | TYPE_NAME | COLUMN_SIZE  | BUFFER_LENGTH  |
DECIMAL_DIGITS  | NUM_PREC_RADIX  | NULLABLE  | REMARKS  | COLUMN_DEF  |
SQL_DATA_TYPE  | SQL_DAT |
++--+-+++---+--++-+-+---+--+-++-+
|| SYSTEM   | CATALOG | TENANT_ID  | 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | TABLE_SCHEM| 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | TABLE_NAME | 12
| VARCHAR   | null | null   | null
   | null| 0 |  | | null
| null|
|| SYSTEM   | CATALOG | COLUMN_NAME| 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | COLUMN_FAMILY  | 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | TABLE_SEQ_NUM  | -5
| BIGINT| null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | TABLE_TYPE | 1
 | CHAR  | 1| null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | PK_NAME| 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | COLUMN_COUNT   | 4
 | INTEGER   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | SALT_BUCKETS   | 4
 | INTEGER   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | DATA_TABLE_NAME| 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | INDEX_STATE| 1
 | CHAR  | 1| null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | IMMUTABLE_ROWS | 16
| BOOLEAN   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | VIEW_STATEMENT | 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | DEFAULT_COLUMN_FAMILY  | 12
| VARCHAR   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | DISABLE_WAL| 16
| BOOLEAN   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | MULTI_TENANT   | 16
| BOOLEAN   | null | null   | null
   | null| 1 |  | | null
| null|
|| SYSTEM   | CATALOG | VIEW_TYPE  | -6
| UNSIGNED_TINYINT  | null | null   | null
   | null| 1 |  | | null
| null|
|  

Re: Cloning a table in Phoenix

2016-09-08 Thread Kumar Palaniappan
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  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 
>>  wrote:
>> What is an easy solution or is there a solution to clone the table/schema in 
>> phoenix?
>> 
>> Thanks in advance.
> 


Re: Cloning a table in Phoenix

2016-09-08 Thread dalin.qin
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 <
kpalaniap...@marinsoftware.com> wrote:

> What is an easy solution or is there a solution to clone the table/schema
> in phoenix?
>
> Thanks in advance.
>
>
>


Cloning a table in Phoenix

2016-09-08 Thread Kumar Palaniappan
What is an easy solution or is there a solution to clone the table/schema
in phoenix?

Thanks in advance.