zoukankan      html  css  js  c++  java
  • hive 以like方式建表(携带表结构)

    hive建表语句:

    CREATE TABLE `hive_ttt_999`(
    `id` bigint COMMENT 'ID,主键', 
    `name` string COMMENT '姓名', 
    `address` string COMMENT '地址', 
    `mobile` string COMMENT '手机号', 
    `other_info` string COMMENT '其他信息', 
    `tenant_id` string COMMENT '租户ID', 
    `created_by` string COMMENT '创建者', 
    `created_time` string COMMENT '创建时间', 
    `updated_time` string COMMENT '更新时间', 
    `updated_by` string COMMENT '更新者', 
    `version` bigint COMMENT '版本号,乐观锁', 
    `is_deleted` bigint COMMENT '是否删除')
    ROW FORMAT SERDE 
    'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
    WITH SERDEPROPERTIES ( 
    'field.delim'='|', 
    'serialization.format'='|') 
    STORED AS INPUTFORMAT 
    'org.apache.hadoop.mapred.TextInputFormat' 
    OUTPUTFORMAT 
    'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
    LOCATION
    'hdfs://nameservice1/user/hive/warehouse/ttt.db/hive_ttt_999'
    TBLPROPERTIES (
    'transient_lastDdlTime'='1629364931')
    

    创建表:(以hive_ttt_999为模板)

    use ttt;
    create table burrowsTest_0 like hive_ttt_999;
    

    用此脚本实现批量打印所需建表/删表语句
    num = 3200
    target_table = 'dct_test_from'

    for x in range(800, num):
    	print(f'create table hive_ttt_{x} like {target_table};')
    	#print(f'drop table hive_ttt_{x};')
    	#print(f"create index hive_ttt_index_{x} on table hive_ttt_{x}(id) as 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' with deferred rebuild;")
    

    给hive表建索引

    create index index_01 on table hive_ttt_999(id) as 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' with deferred rebuild;
    小小测试一枚
  • 相关阅读:
    BAPI LIST
    如何设计折叠屏幕
    图形学习 Javascript 正则 regexper.com
    Javascript 的数据是什么数据类型?
    Javascript 严格模式下不允许删除一个不允许删除的属性
    Javascript 在严格模式下禁止指向 this
    指针自增学习
    Javascript 严格模式下几个禁忌
    笔记本设置 2K 显示屏 Intel HD Graphics 3000
    Javascript 在严格模式下不允许删除变量或对象
  • 原文地址:https://www.cnblogs.com/txdblog/p/15210332.html
Copyright © 2011-2022 走看看