Hey,
How do I export just the projection definitions for a table and not the create table statement? I know I can use the export_objects function, but that includes the table create in the output...
SELECT export_objects('', 'table_name');
Eporting just projection definitions
Moderator: NorbertKrupa
Eporting just projection definitions
THANKS - BECKSTER
Re: Eporting just projection definitions
Hi!
Will work on linux only:
Will work on linux only:
Code: Select all
\set tbl '''customer_dimension'''
SELECT export_objects('', :tbl) \g | awk '{ if ($0 ~ /CREATE PROJECTION/) {proj_started=1}; if (proj_started == 1) {print $0} }';
Re: Eporting just projection definitions
You could also query for the projection names, and then script export_objects() on just the projections.
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC
Vertica Consultant, Zazz Technologies LLC
Re: Eporting just projection definitions
Thanks! Perfect solution provided by the community again! I didn't know that the export_objects function work on projections. I thought it only worked on tables
THANKS - BECKSTER
Re: Eporting just projection definitions
HI!
export_objects function work on table, projection, view, sequence and user-defined SQL function.
export_objects function work on table, projection, view, sequence and user-defined SQL function.
Re: Eporting just projection definitions
Hi, related query, default projections mostly have same name as anchor table.
In that select export_objects('', '<schm_name.tabl_name>', false) will always print export object for the table and not the projections.
How do we get export_objects output for projections with same name as a table ?
In that select export_objects('', '<schm_name.tabl_name>', false) will always print export object for the table and not the projections.
How do we get export_objects output for projections with same name as a table ?
- JimKnicely
- Site Admin
- Posts: 1825
- Joined: Sat Jan 21, 2012 4:58 am
- Contact:
Re: Eporting just projection definitions
Can you post an example where the default projection name generated by Vertica is the same as the anchor table name?
Jim Knicely
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.
Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.