The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

How do you load the data from one schema to other schema?

How do you load the data from one schema to other schema ( table to table in same database). What all options we have to do this in vertica?

Comments

  • There is not a direct command that will copy one schema tables to another schema. However, the script below will help you to automate the process. Make sure that the schema is created and the tables do not exist in the new schema. 1- Create a new schema create schema NEW_SCHEMA ; 2- Create a file for example: copy_schema.sh 3- Copy the content below in the file created above. #!/bin/bash user=dbadmin new_schema=test old_schema=public vsql -ta -c " SELECT 'Create table $new_schema.' || table_name || ' as select * from ' || table_schema || '.' || table_name || '; ' FROM tables where table_schema like '$old_schema'; " | vsql 4- Save the file and give execution privileges chmod +x copy_schema.sh 5- From the operating system command line, as dbadmin user. Run the script ./copy_schema.sh

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.