<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – Using EXPORT functions</title>
    <link>/en/data-export/db-export-and-import/using-export-functions/</link>
    <description>Recent content in Using EXPORT functions on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/data-export/db-export-and-import/using-export-functions/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Data-Export: Exporting the catalog</title>
      <link>/en/data-export/db-export-and-import/using-export-functions/exporting-catalog/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-export/db-export-and-import/using-export-functions/exporting-catalog/</guid>
      <description>
        
        
        &lt;p&gt;Vertica function &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/catalog-functions/export-catalog/&#34;&gt;EXPORT_CATALOG&lt;/a&gt; generates a SQL script for copying a database design to another cluster. This script replicates the physical schema design of the source database. You call this function as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;EXPORT_CATALOG ( [&amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;destination&lt;/span&gt;]&amp;#39; [, &amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;scope&lt;/span&gt;]&amp;#39;]] )
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script conforms to the following requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Only includes objects to which the user has access.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Orders CREATE statements according to object dependencies so they can be recreated in the correct sequence. For example, if a table is in a non-PUBLIC schema, the required CREATE SCHEMA statement precedes the CREATE TABLE statement. Similarly, a table&#39;s CREATE ACCESS POLICY statement follows the table&#39;s CREATE TABLE statement.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If possible, creates projections with their KSAFE clause, if any, otherwise with their OFFSET clause.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;setting-export-scope&#34;&gt;Setting export scope&lt;/h2&gt;
&lt;p&gt;If you omit specifying a scope, EXPORT_CATALOG exports all objects. You can set the scope of the export operation to one of the following levels:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
Scope&lt;/th&gt; 

&lt;th &gt;
Exports...&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;TABLES&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


Tables, schemas, and table-dependent objects: constraints, and access policies&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;

&lt;code&gt;DESIGN&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;


All catalog objects: schemas, tables, constraints, views, access policies, projections, SQL macros, and stored procedures.&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;
&lt;code&gt;DIRECTED_QUERIES&lt;/code&gt;&lt;/td&gt; 

&lt;td &gt;
All directed queries that are stored in the catalog. For details, see &lt;a href=&#34;../../../../en/admin/managing-queries/directed-queries/managing-directed-queries/&#34;&gt;Managing directed queries&lt;/a&gt;.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h2 id=&#34;exporting-table-objects&#34;&gt;Exporting table objects&lt;/h2&gt;
&lt;p&gt;Use the TABLES scope to generate a script that recreates all tables and the objects that they depend on: schemas, sequences, constraints, and access policies:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXPORT_CATALOG (
     &amp;#39;/home/dbadmin/xtest/sql_cat_tables.sql&amp;#39;,
     &amp;#39;TABLES&amp;#39;);
           EXPORT_CATALOG
-------------------------------------
 Catalog data exported successfully
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script can include the following statements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER TABLE (constraints)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SEQUENCE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE ACCESS POLICY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE PROCEDURE (Stored)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;exporting-all-catalog-objects&#34;&gt;Exporting all catalog objects&lt;/h2&gt;
&lt;p&gt;Use the DESIGN scope to export all design elements of a source database in order of their dependencies. This scope exports all catalog objects, including schemas, tables, constraints, projections, views, and access policies.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXPORT_CATALOG(
     &amp;#39;/home/dbadmin/xtest/sql_cat_design.sql&amp;#39;,
     &amp;#39;DESIGN&amp;#39; );
           EXPORT_CATALOG
-------------------------------------
 Catalog data exported successfully
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script include statements that are required to recreate the database:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER TABLE (constraints)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE VIEW&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SEQUENCE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE ACCESS&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE PROJECTION (with ORDER BY and SEGMENTED BY)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;projection-considerations&#34;&gt;Projection considerations&lt;/h2&gt;
&lt;p&gt;If a projection to export was created with no ORDER BY clause, the SQL script reflects the default behavior for projections. Vertica implicitly creates projections using a sort order based on the SELECT columns in the projection definition.&lt;/p&gt;
&lt;p&gt;The EXPORT_CATALOG script is portable if all projections are created using UNSEGMENTED ALL NODES or SEGMENTED ALL NODES.&lt;/p&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/data-export/db-export-and-import/using-export-functions/exporting-objects/&#34;&gt;Exporting objects&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/data-export/db-export-and-import/using-export-functions/exporting-tables/&#34;&gt;Exporting tables&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Data-Export: Exporting tables</title>
      <link>/en/data-export/db-export-and-import/using-export-functions/exporting-tables/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-export/db-export-and-import/using-export-functions/exporting-tables/</guid>
      <description>
        
        
        &lt;p&gt;Vertica function &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/catalog-functions/export-tables/&#34;&gt;EXPORT_TABLES&lt;/a&gt; exports DDL for tables and related objects in the current database. The generated SQL includes all non-virtual table objects to which you have access. You can use this SQL to recreate tables and related non-virtual objects on a different cluster.&lt;/p&gt;
&lt;p&gt;You execute EXPORT_TABLES as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;EXPORT_TABLES( [&amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;destination&lt;/span&gt;]&amp;#39; [, &amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;scope&lt;/span&gt;]&amp;#39;]] )
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script conforms to the following requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Only includes objects to which the user has access.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Orders CREATE statements according to object dependencies so they can be recreated in the correct sequence. For example, if a table references a named sequence, a CREATE SEQUENCE statement precedes the CREATE TABLE statement. Similarly, a table&#39;s CREATE ACCESS POLICY statement follows the table&#39;s CREATE TABLE statement.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;setting-export-scope&#34;&gt;Setting export scope&lt;/h2&gt;
&lt;p&gt;The EXPORT_TABLES &lt;em&gt;&lt;code&gt;scope&lt;/code&gt;&lt;/em&gt; argument specifies the scope of the export operation:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
To export...&lt;/th&gt; 

&lt;th &gt;
Set scope to...&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


All tables to which you have access, including constraints&lt;/td&gt; 

&lt;td &gt;


Empty string (&#39; &#39;)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


One or more named tables&lt;/td&gt; 

&lt;td &gt;








&lt;p&gt;Comma-delimited list of table objects. For example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;myschema.newtable, yourschema.oldtable&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can optionally qualify the schema with the name of the current database:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mydb.myschema.newtable&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


A named table object in the current search path: a schema, table, or sequence. If you specify a schema, EXPORT_TABLES exports all table objects in that schema to which you have access.&lt;/td&gt; 

&lt;td &gt;




&lt;p&gt;Table object&#39;s name and, optionally, its path:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;VMart.myschema&lt;/code&gt;&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

EXPORT_TABLES does not export views. If you specify a view name, Vertica silently ignores it and the view is omitted from the generated script. To export views, use &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/catalog-functions/export-objects/&#34;&gt;EXPORT_OBJECTS&lt;/a&gt;.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;exporting-all-table-objects&#34;&gt;Exporting all table objects&lt;/h2&gt;
&lt;p&gt;If you set the scope parameter to an empty string (&lt;code&gt;&#39;&#39;&lt;/code&gt;), EXPORT_TABLES exports all tables and their related objects. For example, the following call to EXPORT_TABLES exports all table objects in the VMart database to the specified output file.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt; =&amp;gt; SELECT EXPORT_TABLES(
      &amp;#39;/home/dbadmin/xtest/sql_tables_empty.sql&amp;#39;, &amp;#39;&amp;#39;);
            EXPORT_TABLES
-------------------------------------
 Catalog data exported successfully
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The exported SQL includes the following types of statements, depending on what is required to recreate the tables and related objects, such as schemas, sequences and access policies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SEQUENCE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE ACCESS POLICY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER TABLE (to add foreign key constraints)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;exporting-individual-table-objects&#34;&gt;Exporting individual table objects&lt;/h2&gt;
&lt;p&gt;EXPORT_TABLES can specify a comma-separated list of tables and table-related objects such as sequences or schemas to export. The generated SQL script includes the CREATE statements for the specified objects and their dependent objects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SEQUENCE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE ACCESS POLICY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER TABLE (to add foreign keys)&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example, the following call to EXPORT_TABLES exports two VMart tables: &lt;code&gt;store.store_sales_fact&lt;/code&gt; and &lt;code&gt;store.store_dimension&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT export_tables(&amp;#39;&amp;#39;,&amp;#39;store.store_sales_fact, store.store_dimension&amp;#39;);
                              export_tables
-------------------------------------------------------------------------

CREATE TABLE store.store_dimension
(
    store_key int NOT NULL,
    store_name varchar(64),
    store_number int,
    store_address varchar(256),
    store_city varchar(64),
    store_state char(2),
    store_region varchar(64),
    floor_plan_type varchar(32),
    photo_processing_type varchar(32),
    financial_service_type varchar(32),
    selling_square_footage int,
    total_square_footage int,
    first_open_date date,
    last_remodel_date date,
    number_of_employees int,
    annual_shrinkage int,
    foot_traffic int,
    monthly_rent_cost int,
    CONSTRAINT C_PRIMARY PRIMARY KEY (store_key) DISABLED
);

CREATE TABLE store.store_sales_fact
(
    date_key int NOT NULL,
    product_key int NOT NULL,
    product_version int NOT NULL,
    store_key int NOT NULL,
    promotion_key int NOT NULL,
    customer_key int NOT NULL,
    employee_key int NOT NULL,
    pos_transaction_number int NOT NULL,
    sales_quantity int,
    sales_dollar_amount int,
    cost_dollar_amount int,
    gross_profit_dollar_amount int,
    transaction_type varchar(16),
    transaction_time time,
    tender_type varchar(8)
);

ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_date FOREIGN KEY (date_key) references public.date_dimension (date_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_product FOREIGN KEY (product_key, product_version) references public.product_dimension (product_key, product_version);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_store FOREIGN KEY (store_key) references store.store_dimension (store_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_promotion FOREIGN KEY (promotion_key) references public.promotion_dimension (promotion_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_customer FOREIGN KEY (customer_key) references public.customer_dimension (customer_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_employee FOREIGN KEY (employee_key) references public.employee_dimension (employee_key);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The following call to EXPORT_TABLES specifies to export all tables in the VMart schema &lt;code&gt;store&lt;/code&gt; :&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; select export_tables(&amp;#39;&amp;#39;,&amp;#39;store&amp;#39;);
                          export_tables
-----------------------------------------------------------------
CREATE SCHEMA store;

CREATE TABLE store.store_dimension
(
 ...
);

CREATE TABLE store.store_sales_fact
(
 ...
);

CREATE TABLE store.store_orders_fact
(
  ...
);

ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_date FOREIGN KEY (date_key) references public.date_dimension (date_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_product FOREIGN KEY (product_key, product_version) references public.product_dimension (product_key, product_version);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_store FOREIGN KEY (store_key) references store.store_dimension (store_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_promotion FOREIGN KEY (promotion_key) references public.promotion_dimension (promotion_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_customer FOREIGN KEY (customer_key) references public.customer_dimension (customer_key);
ALTER TABLE store.store_sales_fact ADD CONSTRAINT fk_store_sales_employee FOREIGN KEY (employee_key) references public.employee_dimension (employee_key);
ALTER TABLE store.store_orders_fact ADD CONSTRAINT fk_store_orders_product FOREIGN KEY (product_key, product_version) references public.product_dimension (product_key, product_version);
ALTER TABLE store.store_orders_fact ADD CONSTRAINT fk_store_orders_store FOREIGN KEY (store_key) references store.store_dimension (store_key);
ALTER TABLE store.store_orders_fact ADD CONSTRAINT fk_store_orders_vendor FOREIGN KEY (vendor_key) references public.vendor_dimension (vendor_key);
ALTER TABLE store.store_orders_fact ADD CONSTRAINT fk_store_orders_employee FOREIGN KEY (employee_key) references public.employee_dimension (employee_key);

(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/data-export/db-export-and-import/using-export-functions/exporting-objects/&#34;&gt;Exporting objects&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/data-export/db-export-and-import/using-export-functions/exporting-catalog/&#34;&gt;Exporting the catalog&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

      </description>
    </item>
    
    <item>
      <title>Data-Export: Exporting objects</title>
      <link>/en/data-export/db-export-and-import/using-export-functions/exporting-objects/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/data-export/db-export-and-import/using-export-functions/exporting-objects/</guid>
      <description>
        
        
        &lt;p&gt;The Vertica function &lt;a href=&#34;../../../../en/sql-reference/functions/management-functions/catalog-functions/export-objects/&#34;&gt;EXPORT_OBJECTS&lt;/a&gt; generates a SQL script that you can use to recreate non-virtual catalog objects on a different cluster, as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;EXPORT_OBJECTS( [&amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;destination&lt;/span&gt;]&amp;#39; [, &amp;#39;[&lt;span class=&#34;code-variable&#34;&gt;scope&lt;/span&gt;]&amp;#39;] [, &amp;#39;&lt;span class=&#34;code-variable&#34;&gt;mark-ksafe&lt;/span&gt;&amp;#39;]] )
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script conforms to the following requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Only includes objects to which the user has access.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Orders CREATE statements according to object dependencies so they can be recreated in the correct sequence. For example, if a table is in a non-PUBLIC schema, the required CREATE SCHEMA statement precedes the CREATE TABLE statement. Similarly, a table&#39;s CREATE ACCESS POLICY statement follows the table&#39;s CREATE TABLE statement.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If possible, creates projections with their KSAFE clause, if any, otherwise with their OFFSET clause.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;setting-export-scope&#34;&gt;Setting export scope&lt;/h2&gt;
&lt;p&gt;The EXPORT_OBJECTS &lt;em&gt;&lt;code&gt;scope&lt;/code&gt;&lt;/em&gt; argument specifies the scope of the export operation:

&lt;table class=&#34;table table-bordered&#34; &gt;



&lt;tr&gt; 

&lt;th &gt;
To export...&lt;/th&gt; 

&lt;th &gt;
Set scope to...&lt;/th&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


All objects to which you have access&lt;/td&gt; 

&lt;td &gt;


Empty string (&#39;&#39;)&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt; 

&lt;td &gt;


One or more named database objects and related objects&lt;/td&gt; 

&lt;td &gt;










&lt;p&gt;Comma-delimited list of objects. For example:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;myschema.newtable, yourschema.my-sequence&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can optionally qualify the schema with the name of the current database:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;mydb.myschema.newtable&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If you specify a schema, EXPORT_TABLES exports all objects in that schema to which you have access. If you name a table that references a sequence, the generated script shows the sequence, then the table that references the sequence, and finally any projections of that table.&lt;/p&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;


&lt;div class=&#34;alert admonition note&#34; role=&#34;alert&#34;&gt;
&lt;h4 class=&#34;admonition-head&#34;&gt;Note&lt;/h4&gt;

EXPORT_OBJECTS does not export grants. Preserving grants on libraries can be especially important when you upgrade your database: if the prototypes of UDx libraries change, Vertica drops the grants on them. In order to preserve grants on UDx libraries, back up the grants before upgrading, and then restore them in the upgraded database. For details, see &lt;a href=&#34;../../../../en/setup/upgrading/before-you-upgrade/backing-up-and-restoring-grants/&#34;&gt;Backing up and restoring grants&lt;/a&gt;.

&lt;/div&gt;&lt;/p&gt;
&lt;h2 id=&#34;exporting-all-objects&#34;&gt;Exporting all objects&lt;/h2&gt;
&lt;p&gt;If you set the scope parameter to an empty string (&lt;code&gt;&#39;&#39;&lt;/code&gt;), Vertica exports all non-virtual objects from the source database in order of dependencies. Running the generated SQL script on another cluster creates all referenced objects and their dependent objects.&lt;/p&gt;
&lt;p&gt;By default, the function&#39;s KSAFE argument is set to true. In this case, the generated script calls MARK_DESIGN_KSAFE, which replicates K-safety of the original database.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXPORT_OBJECTS(
     &amp;#39;/home/dbadmin/xtest/sql_objects_all.sql&amp;#39;,
     &amp;#39;&amp;#39;,
     &amp;#39;true&amp;#39;);
           EXPORT_OBJECTS
-------------------------------------
 Catalog data exported successfully
(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The SQL script includes the following types of statements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-schema/&#34;&gt;CREATE SCHEMA&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-table/&#34;&gt;CREATE TABLE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/statements/alter-statements/alter-table/&#34;&gt;ALTER TABLE (constraints)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-projection/&#34;&gt;CREATE PROJECTION&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-view/&#34;&gt;CREATE VIEW&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-sequence/&#34;&gt;CREATE SEQUENCE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-access-policy/&#34;&gt;CREATE ACCESS POLICY&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-procedure-stored/&#34;&gt;CREATE PROCEDURE (stored)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-schedule/&#34;&gt;CREATE SCHEDULE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-trigger/&#34;&gt;CREATE TRIGGER&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The following output includes the start and end of the output SQL file, including the MARK_DESIGN_KSAFE statement:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;CREATE SCHEMA store;
CREATE SCHEMA online_sales;
CREATE SEQUENCE public.my_seq ;
CREATE TABLE public.customer_dimension
(
    customer_key int NOT NULL,
    customer_type varchar(16),
    customer_name varchar(256),
    customer_gender varchar(8),
    title varchar(8),
    household_id int,
...

);
...
SELECT MARK_DESIGN_KSAFE(1);
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;exporting-individual-objects&#34;&gt;Exporting individual objects&lt;/h2&gt;
&lt;p&gt;You can specify one or more objects as the function scope, where multiple objects are specified in a comma-delimited list. The names of objects in any non-PUBLIC schema must include their respective schemas. The objects to export can include schemas, tables, views, and sequences. Accordingly, the SQL script includes the following statements, depending on what objects you list and their dependencies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEMA&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TABLE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ALTER TABLE (to add constraints)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE VIEW&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SEQUENCE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE ACCESS POLICY&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE PROCEDURE (Stored)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE SCHEDULE&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;CREATE TRIGGER&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If listed objects have overlapping scopes—for example, the list includes a table and one of its projections—EXPORT_OBJECTS exports the projection only once:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;
=&amp;gt; select export_objects (&amp;#39;&amp;#39;,&amp;#39;customer_dimension, customer_dimension_super&amp;#39;);

                              export_objects
--------------------------------------------------------------------------
CREATE TABLE public.customer_dimension
(
    customer_key int NOT NULL,
    customer_type varchar(16),
    customer_name varchar(256),
    ...
    CONSTRAINT C_PRIMARY PRIMARY KEY (customer_key) DISABLED
);

CREATE ACCESS POLICY ON public.customer_dimension FOR COLUMN customer_address CASE WHEN enabled_role(&amp;#39;administrator&amp;#39;) THEN customer_address ELSE &amp;#39;**************&amp;#39; END ENABLE;

CREATE PROJECTION public.customer_dimension_super /*+basename(customer_dimension),createtype(L)*/
(
 customer_key,
 customer_type,
 customer_name,
  ...
)
AS
 SELECT customer_dimension.customer_key,
        customer_dimension.customer_type,
        customer_dimension.customer_name,
        ...
 FROM public.customer_dimension
 ORDER BY customer_dimension.customer_key
SEGMENTED BY hash(customer_dimension.customer_key) ALL NODES OFFSET 0;

SELECT MARK_DESIGN_KSAFE(0);
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you specify the name of a &lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-procedure-stored/&#34;&gt;stored procedure&lt;/a&gt; without parentheses nor the types of its formal parameters (visible through &lt;a href=&#34;../../../../en/sql-reference/system-tables/v-catalog-schema/user-procedures/&#34;&gt;USER_PROCEDURES&lt;/a&gt;), EXPORT_OBJECTS returns all implementations with that name.&lt;/p&gt;
&lt;p&gt;For example, to export all implementations of the overloaded stored procedure raiseXY:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXPORT_OBJECTS(&amp;#39;&amp;#39;,&amp;#39;raiseXY&amp;#39;);
    EXPORT_OBJECTS
----------------------
CREATE PROCEDURE public.raiseXY(x int, y varchar)
LANGUAGE &amp;#39;PL/vSQL&amp;#39;
SECURITY INVOKER
AS &amp;#39;
BEGIN
RAISE NOTICE &amp;#39;&amp;#39;x = %&amp;#39;&amp;#39;, x;
RAISE NOTICE &amp;#39;&amp;#39;y = %&amp;#39;&amp;#39;, y;
-- some processing statements
END
&amp;#39;;

CREATE PROCEDURE public.raiseXY(x int, y int)
LANGUAGE &amp;#39;PL/vSQL&amp;#39;
SECURITY INVOKER
AS &amp;#39;
BEGIN
RAISE NOTICE &amp;#39;&amp;#39;x = %&amp;#39;&amp;#39;, x;
RAISE NOTICE &amp;#39;&amp;#39;y = %&amp;#39;&amp;#39;, y;
-- some processing statements
END
&amp;#39;;

SELECT MARK_DESIGN_KSAFE(0);

(1 row)
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can export a particular implementation by specifying either the types or both the names and types of its formal parameters:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; SELECT EXPORT_OBJECTS(&amp;#39;&amp;#39;,&amp;#39;raiseXY(int, int)&amp;#39;);
    EXPORT_OBJECTS
----------------------

CREATE PROCEDURE public.raiseXY(x int, y int)
LANGUAGE &amp;#39;PL/vSQL&amp;#39;
SECURITY INVOKER
AS &amp;#39;
BEGIN
RAISE NOTICE &amp;#39;&amp;#39;x = %&amp;#39;&amp;#39;, x;
RAISE NOTICE &amp;#39;&amp;#39;y = %&amp;#39;&amp;#39;, y;
-- some processing statements
END
&amp;#39;;

SELECT MARK_DESIGN_KSAFE(0);

(1 row)
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;see-also&#34;&gt;See also&lt;/h2&gt;
&lt;a href=&#34;../../../../en/data-export/db-export-and-import/using-export-functions/exporting-tables/&#34;&gt;Exporting tables&lt;/a&gt;

      </description>
    </item>
    
  </channel>
</rss>
