迁移源数据表结构 erp_source
将关系型mysql数据的表结构复制到hive中,hive中的表在此刻起名,无需单独在建表。
bin/sqoop create-hive-table
–connect jdbc:mysql://192.168.209.10:3306/erp
–table erp_source
–username root
–password 300318
–hive-table makedata.erp_sourceTwo
迁移源数据 erp_source
从关系数据库mysql导入表结构中的数据到hive中新表中
bin/sqoop import
–connect jdbc:mysql://192.168.209.10:3306/erp
–username root
–password 300318
–table erp_source
–hive-table makedata.erp_sourceTwo
–hive-import
–m 1
迁移爬虫源数据的表结构erp_info
将关系型mysql数据的表结构复制到hive中,hive中的表在此刻起名,无需单独在建表。
bin/sqoop create-hive-table
–connect jdbc:mysql://192.168.209.10:3306/erp
–table erp_info
–username root
–password 300318
–hive-table makedata.erp_info
迁移爬虫源数据erp_info
从关系数据库mysql导入表结构中的数据到hive中新表中
bin/sqoop import
–connect jdbc:mysql://192.168.209.10:3306/erp
–username root
–password 300318
–table erp_info
–hive-table makedata.erp_info
–hive-import
–m 1
把mysql里的知识产权表结构patent_simple_info导入到makedata库下
bin/sqoop create-hive-table
–connect jdbc:mysql://192.168.209.10:3306/erp
–table patent_simple_info
–username root
–password 300318
–hive-table makedata.patent_simple_info
把mysql里的知识产权表中数据patent_simple_info导入到makedata库下
bin/sqoop import
–connect jdbc:mysql://192.168.209.10:3306/erp
–username root
–password 300318
–table patent_simple_info
–hive-table makedata.patent_simple_info
–hive-import
–m 1
把mysql里的知识产权表结构t_erp_company导入到makedata库下
bin/sqoop create-hive-table
–connect jdbc:mysql://192.168.209.10:3306/erp
–table t_erp_company
–username root
–password 300318
–hive-table makedata.t_erp_company
把mysql里的知识产权表中数据t_erp_company导入到makedata库下
bin/sqoop import
–connect jdbc:mysql://192.168.209.10:3306/erp
–username root
–password 300318
–table t_erp_company
–hive-table makedata.t_erp_company
–hive-import
–m 1
把mysql里的知识产权表中数据改变表中某一字段列名
ALTER TABLE erp_info CHANGE region province_id VARCHAR(255) NULL;
hive
里能实现(能走mr需确定到底实现了啥)
select t.organization_code, (case when
(t.province_id IS NULL OR TRIM(t.province_id)=’’) THEN e.region ELSE t.province_id END) as province
from t_erp_company t ,erp_info e
WHERE t.organization_code = e.organizational_code
and t.organization_code = 00025dabf9a34318bbddb06f8c25fb04
and t.organization_code = 0001e916ffe24ad8a320eaefc291edea;