Page 1 of 1

How to pull up an object definition

Posted: Tue Feb 11, 2014 2:31 pm
by Mrao
How can i pull up an object definition? For example, a table definition. I know export_objects can be used, but I think it exports to a file. I want to export it to my query tool/linux command prompt.

Re: How to pull up an object definition

Posted: Tue Feb 11, 2014 3:20 pm
by JimKnicely
Do you mean something like this?

Code: Select all

[dbadmin@vertica01 ~]$ vsql -c "create table test (c1 int, c2 int);"
CREATE TABLE
[dbadmin@vertica01 ~]$ vsql -Atc "select export_objects('', 'test');"


CREATE TABLE snowfall.test
(
    c1 int,
    c2 int
);




SELECT MARK_DESIGN_KSAFE(1);

Re: How to pull up an object definition

Posted: Tue Feb 11, 2014 3:33 pm
by NorbertKrupa
If you read the documentation, you'll see that it does not export to file if you leave the destination parameter empty:

Code: Select all

SELECT EXPORT_OBJECTS('', schema.object);

Re: How to pull up an objection definition

Posted: Tue Feb 11, 2014 9:24 pm
by Mrao
Thanks you.

Which system table holds the objects definitions?

Re: How to pull up an object definition

Posted: Tue Feb 11, 2014 10:23 pm
by NorbertKrupa
I would strongly urge you to take a few minutes to familiarize yourself with the documentation. Many of your questions can be answered there.

The system table v_catalog.columns contains information about table columns.

Re: How to pull up an object definition

Posted: Wed Feb 12, 2014 3:11 am
by Mrao
Thanks for the response.

I read documentation before posting it.

I am from Teradata background and there are some nice features and commands. I posted the questions to see if there are any simple ways of doing it.

For example, in Teradata, if I want to see an objection definition, I use "SHOW TABLE <TABLE NAME>". The command returns the table structure and other components associated with it.

Re: How to pull up an object definition

Posted: Mon Feb 17, 2014 11:00 am
by nnani
Hi,

If you are looking for something as "SHOW TABLE" in Vertica, then the best would be using meta commands in Vertica.

Code: Select all

-- For all Table names
\dt

--For structure of a particular table

\d table_name

Hope this helps.