zoukankan      html  css  js  c++  java
  • Hive数据导入/导出

    1.1 导入/导出规则

    • EXPORT 命令导出数据表或分区,与元数据一起输出到指定位置。又可以从这个输出位置移动到不同的Hadoop 或Hive 实例中,并且使用IMPORT 命令导入。
    • 当导出一个分区表时,原始数据可能位于不同的HDFS位置,同时还支持导出/导入分区的子集。
    • 导出的元数据存储在目标目录中,数据文件则存储在子目录中。
    • EXPORT 和IMPORT 命令独立于所用的数据源和目标元数据数据管理系统;例如,它们可以在Derby和MYSQL数据库之间使用。

    二、导入/导出语法

    • 数据导出(EXPORT)
    EXPORT TABLE tablename [PARTITION (part_column="value"[, ...])] 
      TO 'export_target_path' [ FOR replication('eventid')
    
    • 数据导入(IMPORT)
    IMPORT [[EXTERNAL] TABLE new_or_original_tablename [PARTITION (part_column="value"[, ...])]] 
      FROM 'source_path'
      [LOCATION 'import_target_path']
    

    三、导入/导出实例

    • 简单导入/导出
    export table department to 'hdfs_exports_location/department';
    import from 'hdfs_exports_location/department';
    
    • 导入重命名
    export table department to 'hdfs_exports_location/department';
    import table imported_dept from 'hdfs_exports_location/department';
    
    • 导出分区
    export table employee partition (emp_country="in", emp_state="ka") to 'hdfs_exports_location/employee';
    import from 'hdfs_exports_location/employee';
    
    • 导入分区
    export table employee to 'hdfs_exports_location/employee';
    import table employee partition (emp_country="us", emp_state="tn") from 'hdfs_exports_location
    
    • 指定导入位置
    export table department to 'hdfs_exports_location/department';
    import table department from 'hdfs_exports_location/department' 
           location 'import_target_location/department';
    
    • 作为外部表导入
    export table department to 'hdfs_exports_location/department';
    import external table department from 'hdfs_exports_location/department';
    

    参考资料

  • 相关阅读:
    weblogic12c 2021.4.20 季度补丁 SPB
    一顿debug猛如虎,原来内存OOM
    JDK记录一下
    213. 打家劫舍 II-动态规划-中等
    5526. 最多可达成的换楼请求数目-回溯-困难
    1584. 连接所有点的最小费用-图/最小生成树-中等
    Java-泛型的限制
    Java-泛型-桥方法
    889. 根据前序和后序遍历构造二叉树-树-中等
    1109. 航班预订统计-差分数组-中等
  • 原文地址:https://www.cnblogs.com/charlist/p/7122172.html
Copyright © 2011-2022 走看看