• 使用scala语言编写代码,一键把hive中的DDLsql转化成MySql中的DDLsql


    使用scala语言编写代码,一键把hive中的DDLsql转化成MySql中的DDLsql

    编写hiveDDLsql转化成MySqlDDLsql的代码

    注意
    1、本代码只是转化了大概,如果在字段的数据类型上不一致的话,可以用VSCode打开生成的文件,替换掉你想替换的字段数据类型
    2、在VSCode上也可以使用正则匹配进行替换,如下图,非常好用

    请添加图片描述

    3、这个代码会减少很多重复的工作量,一下转化几百张表,甚至几千张表,一起来提高效率,拒绝当工具人

    下面的代码就是hiveDDLsql转化成MySqlDDLsql的代码

    import java.io.FileWriter
    
    import scala.collection.mutable.ListBuffer
    import scala.io.Source
    
    object GenSql {
      def main(args: Array[String]): Unit = {
        /**
          * 在原本的建表语句上增加预留字段
          * 去掉分区字段
          * 在表名上增加标识
          *
          */
    
        val newDDlSql = new ListBuffer[String]
    
    
        val yuField: String =
          """
            |,f1 string comment '预留字段',
            |f2 string comment '预留字段'
            |
            """.stripMargin
    
    
        //1、读取sql文件
        val sqlStr: String = Source.fromFile("data/hive_ddl_sql.sql").getLines().toList.mkString("\n")
    
        //2、按照分号拆分
        val list: List[String] = sqlStr.split(";").toList
        for (ddlSql: String <- list) {
    
          //查找括号开始和接收位置
          val fieldStart: Int = ddlSql.indexOf("(") + 1
          val fieldEnd: Int = ddlSql.indexOf(")")
    
          //截取列
          val fields: String = ddlSql.substring(fieldStart, fieldEnd)
    
          //增加预留字段
          val mergeField: String = fields + yuField
    
    
          //取出表除了分区后面所有的信息
    
          val rowStaart: Int = ddlSql.indexOf("ROW")
          val info: String = ddlSql.substring(rowStaart)
    
    
          //取出表名
          val tableName: String = ddlSql.substring(ddlSql.indexOf(".") + 1, ddlSql.indexOf("("))
          println(tableName)
    
          //拼接完整sql
    
    
          val newDDL: String =
            s"""
               |CREATE external TABLE IF NOT EXISTS  ods.${tableName.trim}_f (
               |${mergeField.trim}
               ) ${info.trim}
               |
            """.stripMargin
    
    
          newDDlSql.append(newDDL)
        }
    
    
        //将sql保存
        val writer = new FileWriter("data/mysql_ddl_sql.sql")
        writer.write(newDDlSql.mkString(";\n"))
        writer.close()
      }
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75

    hive中的DDLsql

    hive_ddl_sql.sql

    CREATE external TABLE IF NOT EXISTS  ods.ods_t_fcj_nwrs_sellbargain(
        id        STRING comment '身份证号码',
        r_fwzl    STRING comment '房产地址',
        htydjzmj   STRING comment '合同中约定房子面积',
        tntjzmj   STRING comment '房子内建筑面积',
        ftmj      STRING comment '房子分摊建筑面积',
        time_tjba STRING comment '商品房备案时间',
        htzj       STRING comment '合同总价'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_fcj_nwrs_sellbargain/';
    
    
    CREATE external  TABLE IF NOT EXISTS ods.ods_t_ga_hjxx_czrkjbxx_delta(
    GMSFHM         string comment'公民身份号码',
    QFJG           string comment'签发机关',
    YXQXQSRQ       string comment'有效期限起始日期',
    YXQXJZRQ       string comment'有效期限截止日期',
    XM             string comment'姓名',
    CYM            string comment'曾用名',
    XMPY           string comment'姓名拼音',
    CYMPY          string comment'曾用名拼音',
    XB             string comment'性别',
    MZ             string comment'民族',
    CSRQ           string comment'出生日期',
    CSSJ           string comment'出生时间',
    CSDGJDQ        string comment'出生地国家(地区)',
    CSDSSXQ        string comment'出生地省市县(区)',
    CSDXZ          string comment'出生地详址',
    DHHM           string comment'电话号码',
    JHRYXM         string comment'监护人一姓名',
    JHRYGMSFHM     string comment'监护人一公民身份号码',
    JHRYJHGX       string comment'监护人一监护关系',
    JHREXM         string comment'监护人二姓名',
    JHREGMSFHM     string comment'监护人二公民身份号码',
    JHREJHGX       string comment'监护人二监护关系',
    FQXM           string comment'父亲姓名',
    FQGMSFHM       string comment'父亲公民身份号码',
    MQXM           string comment'母亲姓名',
    MQGMSFHM       string comment'母亲公民身份号码',
    POXM           string comment'配偶姓名',
    POGMSFHM       string comment'配偶公民身份号码',
    JGGJDQ         string comment'籍贯国家(地区)',
    JGSSXQ         string comment'籍贯省市县(区)',
    ZJXY           string comment'宗教信仰',
    WHCD           string comment'文化程度',
    HYZK           string comment'婚姻状况',
    BYZK           string comment'兵役状况',
    SG             string comment'身高',
    XX             string comment'血型',
    ZY             string comment'职业',
    ZYLB           string comment'职业类别',
    FWCS           string comment'服务处所',
    XXJB           string comment'信息级别',
    HSQL           string comment'何时迁来',
    HYQL           string comment'何因迁来',
    HGJDQQL        string comment'何国家(地区)迁来',
    HSSXQQL        string comment'何省市县(区)迁来',
    HXZQL          string comment'何详址迁来',
    HSLBZ          string comment'何时来本址',
    HYLBZ          string comment'何因来本址',
    HGJDQLBZ       string comment'何国家(地区)来本址',
    HSSSQLBZ       string comment'何省市县(区)来本址',
    HXZLBZ         string comment'何详址来本址',
    SWRQ           string comment'死亡日期',
    SWZXLB         string comment'死亡注销类别',
    SWZXRQ         string comment'死亡注销日期',
    QCRQ           string comment'迁出日期',
    QCZXLB         string comment'迁出注销类别',
    QWDGJDQ        string comment'迁往地国家(地区)',
    QWDSSXQ        string comment'迁往地省市县(区)',
    QWDXZ          string comment'迁往地详址',
    CSZMBH         string comment'出生证明编号',
    CSZQFRQ        string comment'出生证签发日期',
    HYLB           string comment'行业类别',
    QTSSXQ         string comment'其他省市县(区)',
    QTZZ           string comment'其他住址',
    RYLB           string comment'人员类别',
    HB             string comment'户别',
    YHZGX          string comment'与户主关系',
    RYZT           string comment'人员状态',
    RYSDZT         string comment'人员锁定状态',
    LXDBID         string comment'离线DBID',
    BZ             string comment'备注',
    JLBZ           string comment'记录标志',
    YWNR           string comment'业务内容',
    CJHJYWID       string comment'创建户籍业务ID',
    CCHJYWID       string comment'撤除户籍业务ID',
    QYSJ           string comment'起用时间',
    JSSJ           string comment'结束时间',
    CXBZ           string comment'冲销标志',
    JLX            string comment'街路巷',
    MLPH           string comment'门(楼)牌号',
    MLXZ           string comment'门(楼)详址',
    PCS            string comment'派出所',
    ZRQ            string comment'责任区',
    XZJD           string comment'乡镇(街道)',
    JCWH           string comment'居(村)委会',
    PXH            string comment'排序号',
    MLPID          string comment'门(楼)牌ID',
    SSXQ           string comment'省市县(区)',
    HH             string comment'户号',
    HLX            string comment'户类型',
    HHID           string comment'户号ID',
    BDFW           string comment'变动范围',
    XXQYSJ         string comment'信息启用时间',
    DHHM2          string comment'电话号码2',
    GXSJ           string comment'更新时间戳',
    ZXSJ           string comment'死亡,注销的注销时间',
    CRYNBID        string comment'人员nbidchar',
    CGMSFHM        string comment'身份号码2',
    GXSJD          string comment'日期格式更新时间',
    ZJLB           string comment'证件类别',
    last_mod       string comment'数据更新时间'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_ga_hjxx_czrkjbxx_delta/';
    
    
    CREATE external TABLE IF NOT EXISTS  ods.ods_t_gjj_sspersons(
    spcode string comment '职工内码',
    hjstatus string comment '缴汇状态',
    sncode string comment '单位代码',
    spname string comment '个人姓名',
    id string comment '身份证',
    spcard string comment '卡号',
    sppassword string comment '口令',
    zjfdm string comment '助记符代码',
    spkhrq string comment '开户日期',
    spperm string comment '起缴年月',
    spgz decimal comment '工资基数',
    spsingl decimal  comment '职工缴交率',
    spjcbl decimal  comment '单位缴交率',
    spmfact decimal  comment '月缴额',
    spmfactzg decimal  comment '职工月缴额',
    spjym string comment '最后缴年月',
    ncye  decimal comment '年初余额',
    splast  decimal comment '定期余额',
    dwbfye  decimal comment '余额单位部分',
    grbfye  decimal comment '余额职工部分',
    spmend  decimal comment '余额',
    splastlx  decimal comment '年初利息',
    spout  decimal comment '年内总支出',
    spin  decimal comment '年内总收入',
    bnlx decimal  comment '活期利息积数',
    nclx decimal  comment '定期利息积数',
    dwhjny string comment '单位汇缴年月',
    zghjny string comment '职工汇缴年月',
    btyje  decimal comment '补贴月缴额',
    btye  decimal comment '余额补贴部分',
    btbl decimal  comment '补贴计缴比例',
    bthjny string comment '补贴汇缴年月',
    spxh string comment '销户标志',
    spzy string comment '转移标志',
    spxhrq string comment '销户日期',
    splr decimal  comment '录入员',
    spoldbankno string comment '原帐号',
    spdk string comment '是否贷款',
    spdy string comment '是否抵押',
    zhdj string comment '帐户冻结',
    spnote string comment '备注',
    modifytime string comment '最后修改时间',
    status string comment '联名卡状态',
    cbank string comment '联名卡发卡银行',
    bcyje  decimal comment '补充月缴额',
    bcye  decimal comment '余额补充',
    bcbl decimal  comment '补充计缴比例',
    bchjny string comment ' 补充最后汇款年月',
    zjzl decimal  comment '缴存资金种类'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gjj_sspersons/';
    
    
    CREATE external TABLE IF NOT EXISTS  ods.ods_t_gsj_reg_investor(
        id STRING comment '身份证号码'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gsj_reg_investor/';
    
    
    CREATE external TABLE IF NOT EXISTS  ods.ods_t_gsj_reg_legrepre(
    id string comment '证件编号',
    position string comment '职务',
    tel string comment '联系电话',
    appounit string comment '任免机构',
    accdside string comment '派出单位',
    posbrmode string comment '产生方式',
    offhfrom string comment '任职期限起',
    offhto string comment '任职期限止',
    stufftype string comment '资料类型代码'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gsj_reg_legrepre/';
    
    
    CREATE external TABLE IF NOT EXISTS  ods.ods_t_rs_zhcs_az01bsbkxx(
    id string comment '身份证号',
    citty_id string comment '城市代码',
    ss_id string comment '社保卡号',
    fkrq string comment '发卡日期',
    yxqz string comment '有效期至',
    aaz502 string comment '卡状态',
    aae008 string comment '开户银行',
    aae008b string comment '银行网点',
    aae010 string comment '金融卡号',
    aae010a string comment '金融帐户',
    aae010b string comment '个人帐户'
    )PARTITIONED BY
    (
        ds   STRING
    )
    ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_rs_zhcs_az01bsbkxx/';
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235

    MySql中的DDLsql

    mysql_ddl_sql.sql

    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_fcj_nwrs_sellbargain (
    id        STRING comment '身份证号码',
        r_fwzl    STRING comment '房产地址',
        htydjzmj   STRING comment '合同中约定房子面积',
        tntjzmj   STRING comment '房子内建筑面积',
        ftmj      STRING comment '房子分摊建筑面积',
        time_tjba STRING comment '商品房备案时间',
        htzj       STRING comment '合同总价'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_fcj_nwrs_sellbargain/'
    ;
    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_ga_hjxx_czrkjbxx_delta (
    GMSFHM         string comment'公民身份号码',
    QFJG           string comment'签发机关',
    YXQXQSRQ       string comment'有效期限起始日期',
    YXQXJZRQ       string comment'有效期限截止日期',
    XM             string comment'姓名',
    CYM            string comment'曾用名',
    XMPY           string comment'姓名拼音',
    CYMPY          string comment'曾用名拼音',
    XB             string comment'性别',
    MZ             string comment'民族',
    CSRQ           string comment'出生日期',
    CSSJ           string comment'出生时间',
    CSDGJDQ        string comment'出生地国家(地区)',
    CSDSSXQ        string comment'出生地省市县(区)',
    CSDXZ          string comment'出生地详址',
    DHHM           string comment'电话号码',
    JHRYXM         string comment'监护人一姓名',
    JHRYGMSFHM     string comment'监护人一公民身份号码',
    JHRYJHGX       string comment'监护人一监护关系',
    JHREXM         string comment'监护人二姓名',
    JHREGMSFHM     string comment'监护人二公民身份号码',
    JHREJHGX       string comment'监护人二监护关系',
    FQXM           string comment'父亲姓名',
    FQGMSFHM       string comment'父亲公民身份号码',
    MQXM           string comment'母亲姓名',
    MQGMSFHM       string comment'母亲公民身份号码',
    POXM           string comment'配偶姓名',
    POGMSFHM       string comment'配偶公民身份号码',
    JGGJDQ         string comment'籍贯国家(地区)',
    JGSSXQ         string comment'籍贯省市县(区)',
    ZJXY           string comment'宗教信仰',
    WHCD           string comment'文化程度',
    HYZK           string comment'婚姻状况',
    BYZK           string comment'兵役状况',
    SG             string comment'身高',
    XX             string comment'血型',
    ZY             string comment'职业',
    ZYLB           string comment'职业类别',
    FWCS           string comment'服务处所',
    XXJB           string comment'信息级别',
    HSQL           string comment'何时迁来',
    HYQL           string comment'何因迁来',
    HGJDQQL        string comment'何国家(地区)迁来',
    HSSXQQL        string comment'何省市县(区)迁来',
    HXZQL          string comment'何详址迁来',
    HSLBZ          string comment'何时来本址',
    HYLBZ          string comment'何因来本址',
    HGJDQLBZ       string comment'何国家(地区)来本址',
    HSSSQLBZ       string comment'何省市县(区)来本址',
    HXZLBZ         string comment'何详址来本址',
    SWRQ           string comment'死亡日期',
    SWZXLB         string comment'死亡注销类别',
    SWZXRQ         string comment'死亡注销日期',
    QCRQ           string comment'迁出日期',
    QCZXLB         string comment'迁出注销类别',
    QWDGJDQ        string comment'迁往地国家(地区)',
    QWDSSXQ        string comment'迁往地省市县(区)',
    QWDXZ          string comment'迁往地详址',
    CSZMBH         string comment'出生证明编号',
    CSZQFRQ        string comment'出生证签发日期',
    HYLB           string comment'行业类别',
    QTSSXQ         string comment'其他省市县(区)',
    QTZZ           string comment'其他住址',
    RYLB           string comment'人员类别',
    HB             string comment'户别',
    YHZGX          string comment'与户主关系',
    RYZT           string comment'人员状态',
    RYSDZT         string comment'人员锁定状态',
    LXDBID         string comment'离线DBID',
    BZ             string comment'备注',
    JLBZ           string comment'记录标志',
    YWNR           string comment'业务内容',
    CJHJYWID       string comment'创建户籍业务ID',
    CCHJYWID       string comment'撤除户籍业务ID',
    QYSJ           string comment'起用时间',
    JSSJ           string comment'结束时间',
    CXBZ           string comment'冲销标志',
    JLX            string comment'街路巷',
    MLPH           string comment'门(楼)牌号',
    MLXZ           string comment'门(楼)详址',
    PCS            string comment'派出所',
    ZRQ            string comment'责任区',
    XZJD           string comment'乡镇(街道)',
    JCWH           string comment'居(村)委会',
    PXH            string comment'排序号',
    MLPID          string comment'门(楼)牌ID',
    SSXQ           string comment'省市县(区)',
    HH             string comment'户号',
    HLX            string comment'户类型',
    HHID           string comment'户号ID',
    BDFW           string comment'变动范围',
    XXQYSJ         string comment'信息启用时间',
    DHHM2          string comment'电话号码2',
    GXSJ           string comment'更新时间戳',
    ZXSJ           string comment'死亡,注销的注销时间',
    CRYNBID        string comment'人员nbidchar',
    CGMSFHM        string comment'身份号码2',
    GXSJD          string comment'日期格式更新时间',
    ZJLB           string comment'证件类别',
    last_mod       string comment'数据更新时间'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_ga_hjxx_czrkjbxx_delta/'
    ;
    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_gjj_sspersons (
    spcode string comment '职工内码',
    hjstatus string comment '缴汇状态',
    sncode string comment '单位代码',
    spname string comment '个人姓名',
    id string comment '身份证',
    spcard string comment '卡号',
    sppassword string comment '口令',
    zjfdm string comment '助记符代码',
    spkhrq string comment '开户日期',
    spperm string comment '起缴年月',
    spgz decimal comment '工资基数',
    spsingl decimal  comment '职工缴交率',
    spjcbl decimal  comment '单位缴交率',
    spmfact decimal  comment '月缴额',
    spmfactzg decimal  comment '职工月缴额',
    spjym string comment '最后缴年月',
    ncye  decimal comment '年初余额',
    splast  decimal comment '定期余额',
    dwbfye  decimal comment '余额单位部分',
    grbfye  decimal comment '余额职工部分',
    spmend  decimal comment '余额',
    splastlx  decimal comment '年初利息',
    spout  decimal comment '年内总支出',
    spin  decimal comment '年内总收入',
    bnlx decimal  comment '活期利息积数',
    nclx decimal  comment '定期利息积数',
    dwhjny string comment '单位汇缴年月',
    zghjny string comment '职工汇缴年月',
    btyje  decimal comment '补贴月缴额',
    btye  decimal comment '余额补贴部分',
    btbl decimal  comment '补贴计缴比例',
    bthjny string comment '补贴汇缴年月',
    spxh string comment '销户标志',
    spzy string comment '转移标志',
    spxhrq string comment '销户日期',
    splr decimal  comment '录入员',
    spoldbankno string comment '原帐号',
    spdk string comment '是否贷款',
    spdy string comment '是否抵押',
    zhdj string comment '帐户冻结',
    spnote string comment '备注',
    modifytime string comment '最后修改时间',
    status string comment '联名卡状态',
    cbank string comment '联名卡发卡银行',
    bcyje  decimal comment '补充月缴额',
    bcye  decimal comment '余额补充',
    bcbl decimal  comment '补充计缴比例',
    bchjny string comment ' 补充最后汇款年月',
    zjzl decimal  comment '缴存资金种类'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gjj_sspersons/'
    ;
    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_gsj_reg_investor (
    id STRING comment '身份证号码'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gsj_reg_investor/'
    ;
    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_gsj_reg_legrepre (
    id string comment '证件编号',
    position string comment '职务',
    tel string comment '联系电话',
    appounit string comment '任免机构',
    accdside string comment '派出单位',
    posbrmode string comment '产生方式',
    offhfrom string comment '任职期限起',
    offhto string comment '任职期限止',
    stufftype string comment '资料类型代码'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_gsj_reg_legrepre/'
    ;
    
    CREATE external TABLE IF NOT EXISTS ods.ods_t_rs_zhcs_az01bsbkxx (
    id string comment '身份证号',
    citty_id string comment '城市代码',
    ss_id string comment '社保卡号',
    fkrq string comment '发卡日期',
    yxqz string comment '有效期至',
    aaz502 string comment '卡状态',
    aae008 string comment '开户银行',
    aae008b string comment '银行网点',
    aae010 string comment '金融卡号',
    aae010a string comment '金融帐户',
    aae010b string comment '个人帐户'
    
    ,f1 String comment "预留字段1",
    f2 String comment "预留字段2"
    )ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
    STORED AS textfile
    location '/daas/motl/ods/ods_t_rs_zhcs_az01bsbkxx/'
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
  • 相关阅读:
    简易开发一个app
    【python经验总结】我与bug的那些日子
    队列题目:设计循环双端队列
    easyrecovery数据恢复软件免费版下载
    Python中的函数
    Centos (含Rocky-Linux) VSFTPD 简单设置
    【CSS应用篇】——CSS如何实现圆角边框
    深入理解Java虚拟机:Java内存区域与内存溢出异常
    充分复用离线空闲算力,降低了实时计算资源开支
    onnx手术刀(ONNX-GraphSurgeon):对模型的输入端进行增,删,改操作(一)
  • 原文地址:https://blog.csdn.net/m0_49889089/article/details/125546536