You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Mich Talebzadeh <mi...@gmail.com> on 2020/04/11 13:36:30 UTC

Reverse engineer a phoneix table definition

Hi,

I was wondering if anyone has a handy script to reverse engineer an
existing table schema.

I guess one can get the info from system.catalog table to start with.
However, I was wondering if there is a shell script already or I have to
write my own.

Thanks,

Dr Mich Talebzadeh



LinkedIn * https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
<https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw>*



http://talebzadehmich.wordpress.com


*Disclaimer:* Use it at your own risk. Any and all responsibility for any
loss, damage or destruction of data or any other property which may arise
from relying on this email's technical content is explicitly disclaimed.
The author will in no case be liable for any monetary damages arising from
such loss, damage or destruction.

Re: Reverse engineer a phoneix table definition

Posted by Josh Elser <el...@apache.org>.
That should be there already, but that doesn't help the existing 4.x 
release lines (which, I assume, would be what Mich cares about).

On 4/14/20 11:59 AM, Sukumar Maddineni wrote:
> How about a simple idea of redirecting all DDL statements to SYSTEM.LOG 
> by default which will be useful for logging+auditing purposes and also 
> for recreating table if needed.
> 
> --
> Sukumar
> 
> On Tue, Apr 14, 2020 at 8:49 AM Geoffrey Jacoby <gjacoby@salesforce.com 
> <ma...@salesforce.com>> wrote:
> 
>     This is a frequent feature request we unfortunately haven't
>     implemented yet -- see PHOENIX-4286 and PHOENIX-5054, one of which I
>     filed and the other one Josh did. :-)
> 
>     I agree with Josh, I'd love to see an implementation of this if
>     someone has bandwidth.
> 
>     Geoffrey Jacoby
> 
>     On Tue, Apr 14, 2020 at 8:01 AM Josh Elser <elserj@apache.org
>     <ma...@apache.org>> wrote:
> 
>         Yeah, I don't have anything handy.
> 
>         I'll happily review and commit such a utility if you happen to
>         write one
>         (even if flawed).
> 
>         On 4/12/20 1:31 AM, Simon Mottram wrote:
>          > Best I can offer is
>          >
>          >   "SELECT * FROM SYSTEM.CATALOG where table_name = '" +
>         tableName + "'
>          > and table_schem = '"  +schemaName + "'"
>          >
>          > S
>          >
>         ------------------------------------------------------------------------
>          > *From:* Mich Talebzadeh <mich.talebzadeh@gmail.com
>         <ma...@gmail.com>>
>          > *Sent:* Sunday, 12 April 2020 1:36 AM
>          > *To:* user <user@phoenix.apache.org
>         <ma...@phoenix.apache.org>>
>          > *Subject:* Reverse engineer a phoneix table definition
>          > Hi,
>          >
>          > I was wondering if anyone has a handy script to reverse
>         engineer an
>          > existing table schema.
>          >
>          > I guess one can get the info from system.catalog table to
>         start with.
>          > However, I was wondering if there is a shell script already
>         or I have to
>          > write my own.
>          >
>          > Thanks,
>          >
>          > Dr Mich Talebzadeh
>          >
>          > LinkedIn
>          >
>         /https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw/
>          >
>          > http://talebzadehmich.wordpress.com
>          >
>          >
>          > *Disclaimer:* Use it at your own risk.Any and all
>         responsibility for any
>          > loss, damage or destruction of data or any other property
>         which may
>          > arise from relying on this email's technical content is
>         explicitly
>          > disclaimed. The author will in no case be liable for any
>         monetary
>          > damages arising from such loss, damage or destruction.
>          >
> 
> 
> 
> -- 
> 
> <https://smart.salesforce.com/sig/smaddineni//us_mb/default/link.html>

Re: Reverse engineer a phoneix table definition

Posted by Sukumar Maddineni <sm...@salesforce.com>.
How about a simple idea of redirecting all DDL statements to SYSTEM.LOG by
default which will be useful for logging+auditing purposes and also for
recreating table if needed.

--
Sukumar

On Tue, Apr 14, 2020 at 8:49 AM Geoffrey Jacoby <gj...@salesforce.com>
wrote:

> This is a frequent feature request we unfortunately haven't implemented
> yet -- see PHOENIX-4286 and PHOENIX-5054, one of which I filed and the
> other one Josh did. :-)
>
> I agree with Josh, I'd love to see an implementation of this if someone
> has bandwidth.
>
> Geoffrey Jacoby
>
> On Tue, Apr 14, 2020 at 8:01 AM Josh Elser <el...@apache.org> wrote:
>
>> Yeah, I don't have anything handy.
>>
>> I'll happily review and commit such a utility if you happen to write one
>> (even if flawed).
>>
>> On 4/12/20 1:31 AM, Simon Mottram wrote:
>> > Best I can offer is
>> >
>> >   "SELECT * FROM SYSTEM.CATALOG where table_name = '" + tableName + "'
>> > and table_schem = '"  +schemaName + "'"
>> >
>> > S
>> > ------------------------------------------------------------------------
>> > *From:* Mich Talebzadeh <mi...@gmail.com>
>> > *Sent:* Sunday, 12 April 2020 1:36 AM
>> > *To:* user <us...@phoenix.apache.org>
>> > *Subject:* Reverse engineer a phoneix table definition
>> > Hi,
>> >
>> > I was wondering if anyone has a handy script to reverse engineer an
>> > existing table schema.
>> >
>> > I guess one can get the info from system.catalog table to start with.
>> > However, I was wondering if there is a shell script already or I have
>> to
>> > write my own.
>> >
>> > Thanks,
>> >
>> > Dr Mich Talebzadeh
>> >
>> > LinkedIn
>> > /
>> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw/
>> >
>> > http://talebzadehmich.wordpress.com
>> >
>> >
>> > *Disclaimer:* Use it at your own risk.Any and all responsibility for
>> any
>> > loss, damage or destruction of data or any other property which may
>> > arise from relying on this email's technical content is explicitly
>> > disclaimed. The author will in no case be liable for any monetary
>> > damages arising from such loss, damage or destruction.
>> >
>>
>

-- 

<https://smart.salesforce.com/sig/smaddineni//us_mb/default/link.html>

Re: Reverse engineer a phoneix table definition

Posted by Geoffrey Jacoby <gj...@salesforce.com>.
This is a frequent feature request we unfortunately haven't implemented yet
-- see PHOENIX-4286 and PHOENIX-5054, one of which I filed and the other
one Josh did. :-)

I agree with Josh, I'd love to see an implementation of this if someone has
bandwidth.

Geoffrey Jacoby

On Tue, Apr 14, 2020 at 8:01 AM Josh Elser <el...@apache.org> wrote:

> Yeah, I don't have anything handy.
>
> I'll happily review and commit such a utility if you happen to write one
> (even if flawed).
>
> On 4/12/20 1:31 AM, Simon Mottram wrote:
> > Best I can offer is
> >
> >   "SELECT * FROM SYSTEM.CATALOG where table_name = '" + tableName + "'
> > and table_schem = '"  +schemaName + "'"
> >
> > S
> > ------------------------------------------------------------------------
> > *From:* Mich Talebzadeh <mi...@gmail.com>
> > *Sent:* Sunday, 12 April 2020 1:36 AM
> > *To:* user <us...@phoenix.apache.org>
> > *Subject:* Reverse engineer a phoneix table definition
> > Hi,
> >
> > I was wondering if anyone has a handy script to reverse engineer an
> > existing table schema.
> >
> > I guess one can get the info from system.catalog table to start with.
> > However, I was wondering if there is a shell script already or I have to
> > write my own.
> >
> > Thanks,
> >
> > Dr Mich Talebzadeh
> >
> > LinkedIn
> > /
> https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw/
> >
> > http://talebzadehmich.wordpress.com
> >
> >
> > *Disclaimer:* Use it at your own risk.Any and all responsibility for any
> > loss, damage or destruction of data or any other property which may
> > arise from relying on this email's technical content is explicitly
> > disclaimed. The author will in no case be liable for any monetary
> > damages arising from such loss, damage or destruction.
> >
>

Re: Reverse engineer a phoneix table definition

Posted by Josh Elser <el...@apache.org>.
Yeah, I don't have anything handy.

I'll happily review and commit such a utility if you happen to write one 
(even if flawed).

On 4/12/20 1:31 AM, Simon Mottram wrote:
> Best I can offer is
> 
>   "SELECT * FROM SYSTEM.CATALOG where table_name = '" + tableName + "' 
> and table_schem = '"  +schemaName + "'"
> 
> S
> ------------------------------------------------------------------------
> *From:* Mich Talebzadeh <mi...@gmail.com>
> *Sent:* Sunday, 12 April 2020 1:36 AM
> *To:* user <us...@phoenix.apache.org>
> *Subject:* Reverse engineer a phoneix table definition
> Hi,
> 
> I was wondering if anyone has a handy script to reverse engineer an 
> existing table schema.
> 
> I guess one can get the info from system.catalog table to start with. 
> However, I was wondering if there is a shell script already or I have to 
> write my own.
> 
> Thanks,
> 
> Dr Mich Talebzadeh
> 
> LinkedIn 
> /https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw/
> 
> http://talebzadehmich.wordpress.com
> 
> 
> *Disclaimer:* Use it at your own risk.Any and all responsibility for any 
> loss, damage or destruction of data or any other property which may 
> arise from relying on this email's technical content is explicitly 
> disclaimed. The author will in no case be liable for any monetary 
> damages arising from such loss, damage or destruction.
> 

Re: Reverse engineer a phoneix table definition

Posted by Simon Mottram <Si...@cucumber.co.nz>.
Best I can offer is

 "SELECT * FROM SYSTEM.CATALOG where table_name = '" + tableName + "' and table_schem = '"  +schemaName + "'"

S
________________________________
From: Mich Talebzadeh <mi...@gmail.com>
Sent: Sunday, 12 April 2020 1:36 AM
To: user <us...@phoenix.apache.org>
Subject: Reverse engineer a phoneix table definition

Hi,

I was wondering if anyone has a handy script to reverse engineer an existing table schema.

I guess one can get the info from system.catalog table to start with. However, I was wondering if there is a shell script already or I have to write my own.

Thanks,


Dr Mich Talebzadeh



LinkedIn  https://www.linkedin.com/profile/view?id=AAEAAAAWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw



http://talebzadehmich.wordpress.com


Disclaimer: Use it at your own risk. Any and all responsibility for any loss, damage or destruction of data or any other property which may arise from relying on this email's technical content is explicitly disclaimed. The author will in no case be liable for any monetary damages arising from such loss, damage or destruction.