zoukankan      html  css  js  c++  java
  • [Hive

     
    Skip to end of metadata
     
    Go to start of metadata
     

    Import/Export

    Version

    Icon

    The EXPORT and IMPORT commands were added in Hive 0.8.0 (see HIVE-1918).

    Overview

    The EXPORT command exports the data of a table or partition, along with the metadata, into a specified output location. This output location can then be moved over to a different Hadoop or Hive instance and imported from there with the IMPORT command.

    When exporting a partitioned table, the original data may be located in different HDFS locations. The ability to export/import a subset of the partition is also supported.

    Exported metadata is stored in the target directory, and data files are stored in subdirectories.

    The EXPORT and IMPORT commands work independently(独立地) of the source and target metastore DBMS used; for example, they can be used between Derby and MySQL databases.

    Export Syntax

    EXPORT TABLE tablename [PARTITION (part_column="value"[, ...])]
      TO 'export_target_path'

    Import Syntax

    IMPORT [[EXTERNAL] TABLE new_or_original_tablename [PARTITION (part_column="value"[, ...])]]
      FROM 'source_path'
      [LOCATION 'import_target_path']

    Examples

    Simple export and import:

    export table department to 'hdfs_exports_location/department';
    import from 'hdfs_exports_location/department';
    

    Rename table on import:

    export table department to 'hdfs_exports_location/department';
    import table imported_dept from 'hdfs_exports_location/department';
    

    Export partition and import:

    export table employee partition (emp_country="in", emp_state="ka") to 'hdfs_exports_location/employee';
    import from 'hdfs_exports_location/employee';
    

    Export table and import partition:

    export table employee to 'hdfs_exports_location/employee';
    import table employee partition (emp_country="us", emp_state="tn") from 'hdfs_exports_location/employee';
    

    Specify the import location:

    export table department to 'hdfs_exports_location/department';
    import table department from 'hdfs_exports_location/department' 
           location 'import_target_location/department';
    

    Import as an external table:

    export table department to 'hdfs_exports_location/department';
    import external table department from 'hdfs_exports_location/department';
    
     
    谨言慎行,专注思考 , 工作与生活同乐
  • 相关阅读:
    软件工程--团队作业3
    软件工程--团队作业2
    软件工程第二次作业---结对编程
    软件工程第一次作业补充
    软件工程第一次作业
    用Use Case获取需求的方法是否有什么缺陷,还有什么地方需要改进?
    买卖股票的最佳时机
    爬楼梯
    删除排序数组中的重复数字
    1500802035王叔文
  • 原文地址:https://www.cnblogs.com/tmeily/p/4248231.html
Copyright © 2011-2022 走看看