May 13, 2023

Hive create backup table - Create Table As VS Create Table Like

 

  • How to create a new table from an existing partitioned table (new table should not contain partitions) ?

    • create table txnrecords_dp_bkp as select * from txnrecords_dp;

      • Map reduce job will run as it is copying

      • Only data & schema is copied, not partitions

      • show partitions txnrecords_dp_bkp;

        • No partitions are copied

  • Create only backup table only schema from existing table

    • create table txnrecords_dp_bkp_schema LIKE txnrecords_dp;

      • Only schema & partitions is copied (but no data)

No comments:

Post a Comment