The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!
Is it possible to get a recommended DDL by submitting query transaction_id?

Is it possible to get a recommended DDL by submitting query transaction_id?
0
Answers
Please elaborate, DDL for what?
For example, to see the query itself do:
SELECT request FROM v_monitor.query_requests WHERE transaction_id=45035996273704967 AND statement_id=1;
To see the create table DDL for a specific table (and its projections) from the query:
SELECT EXPORT_OBJECTS('New_file_name_for_the_DDL_output','schema_name.table_name','true');
If you mean to detect a DDL for a not yet existing table that would match a given SELECT, then no.
Workaround is:
CREATE TABLE throw_me_away AS SELECT * FROM (<your fullselect) foo WHERE FALSE;
. Then, runSELECT EXPORT_OBJECTS('','throw_me_away',FALSE)
to get the DDL, and finally,DROP TABLE throw_me_away;
.@mosheg I mean DDL for create projection
If you mean using Database Designer, then something like:
Provided that
query_requests
system table still has the transaction id (this is based on your retention policy)Refer the following doc for details on each of the above functions:
https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/Functions/VerticaFunctions/DatabaseDesigner/DatabaseDesignerFunctions.htm
@LenoyJ The error message occured.. "Design type INCREMENT is invalid" when i was using the query SELECT DESIGNER_SET_DESIGN_TYPE('design1','INCREMENTAL');
Works fine for me:

Make sure it's "INCREMENTAL", not "INCREMENT"
@LenoyJ OMG .. Thank you very much
@LenoyJ then do i need to create sql file( design1_projections.sql, design1_deploy.sql)for this script??
SELECT DESIGNER_RUN_POPULATE_DESIGN_AND_DEPLOY ( 'design1', '/tmp/design1_projections.sql', '/tmp/design1_deploy.sql', 'true', 'false', 'false', 'false' );