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';
    
     
    谨言慎行,专注思考 , 工作与生活同乐
  • 相关阅读:
    linux 笔记 一
    DOS命令大全(经典收藏)
    win7+vmware8+centos6.3安装lamp
    php定时计划任务的实现原理
    用mootools开发的轮播图组件
    Git的使用感受
    崛起中的九大HTML5开发工具
    vi 基本命令
    linux grep命令
    写给2013年的自己
  • 原文地址:https://www.cnblogs.com/tmeily/p/4248231.html
Copyright © 2011-2022 走看看