How to pull up an object definition

Moderator: NorbertKrupa

Post Reply
Mrao
Newbie
Newbie
Posts: 22
Joined: Mon Feb 03, 2014 2:07 pm

How to pull up an object definition

Post by Mrao » Tue Feb 11, 2014 2:31 pm

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.

User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1800
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Re: How to pull up an object definition

Post by JimKnicely » Tue Feb 11, 2014 3:20 pm

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);
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: How to pull up an object definition

Post by NorbertKrupa » Tue Feb 11, 2014 3:33 pm

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);
Checkout vertica.tips for more Vertica resources.

Mrao
Newbie
Newbie
Posts: 22
Joined: Mon Feb 03, 2014 2:07 pm

Re: How to pull up an objection definition

Post by Mrao » Tue Feb 11, 2014 9:24 pm

Thanks you.

Which system table holds the objects definitions?

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: How to pull up an object definition

Post by NorbertKrupa » Tue Feb 11, 2014 10:23 pm

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.
Checkout vertica.tips for more Vertica resources.

Mrao
Newbie
Newbie
Posts: 22
Joined: Mon Feb 03, 2014 2:07 pm

Re: How to pull up an object definition

Post by Mrao » Wed Feb 12, 2014 3:11 am

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.

User avatar
nnani
Master
Master
Posts: 302
Joined: Fri Apr 13, 2012 6:28 am
Contact:

Re: How to pull up an object definition

Post by nnani » Mon Feb 17, 2014 11:00 am

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.
nnani........
Long way to go

You can check out my blogs at vertica-howto

Post Reply

Return to “Vertica SQL Functions”