- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to export DDL's of all table's for a schema in Hive
- Labels:
-
Apache Hive
Created 01-10-2023 07:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
Do we have any script to export all the DDL's of the table for a schema in Hive ? we have a schema name - staging_DB and its contains around 2000 tables, now we need to export all the DDL's of this tables to a txt file so that we can run this DDL's in another setup. Please suggest if we have any script or any easy way to do it, thank you.
- PK
Created 01-10-2023 09:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Prakodi,
We do not have a specific script to export all the DDL's of the table for a schema in hive, however, what you are looking for could be solved with the command
SHOW CREATE TABLE <HIVE_Table_name>;
and you will have to put this in the shell script to retrieve all the table names first and then run show create table for all the tables of the schema.
I did a search online and found an external blog article doing the same. Please refer that
https://dwgeek.com/export-hive-table-ddl-syntax-and-shell-script-example.html/
Let us know if you have any questions.
- Varun
Created 01-13-2023 09:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@prakodi Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created 01-10-2023 09:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Prakodi,
We do not have a specific script to export all the DDL's of the table for a schema in hive, however, what you are looking for could be solved with the command
SHOW CREATE TABLE <HIVE_Table_name>;
and you will have to put this in the shell script to retrieve all the table names first and then run show create table for all the tables of the schema.
I did a search online and found an external blog article doing the same. Please refer that
https://dwgeek.com/export-hive-table-ddl-syntax-and-shell-script-example.html/
Let us know if you have any questions.
- Varun
Created 01-13-2023 09:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@prakodi Has the reply helped resolve your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future. Thanks
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
