Import hive data to MySQL

Source: Internet
Author: User

Import hiveDataMySQL

1. UDF

UseUDFConvenient,CodeInHttp://svn.apache.org/repos/asf/hive/trunk/contrib/src/java/org/apache/hadoop/hive/contrib/genericudf/example/GenericUDFDBOutput.java

Create temporary function dboutput as 'hive. UDF. genericudfdboutput ';

Usage: Select dboutput ('jdbc: mysql: // ebpptest01: 3306/db', 'root', '123', 'insert ignore into mysql_table (merabbr, merchantcm) values (?,?) ', Merabbr, merchantcm) from hive_table

2. sqoop-hcatalog

Install sqoop,HIve-0.11.0 version integrated with hcatalog

Usage sqoop export -- connect JDBC: mysql: // ebpptest01: 3306/DB -- username root -- password 111111 -- hive-partition-key statdate -- hive-partition-value 2013-08-12-Table mysql_table -- hcatalog-Table hive_mysql

3. sqoop

Usage:Sqoop export -- connect JDBC: mysql: // ebpptest01: 3306/DB -- username root -- password 111111 -- table mysql_table -- export-DIR/user/hive/warehouse/hive_table/dt = 2013-08-14

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.