Data Movement and Integration
Also available as:
loading table of contents...

Configuring a Sqoop Action to Use Tez to Load Data into a Hive Table

You can use the Tez execution engine to load data into a Hive table using the --hive-import option,

In the code example in each step, replace the sample text in [square brackets] with the appropriate information for your configuration.

  1. Create a workflow directory.

    hdfs dfs -mkdir -p [/user/dummy/app]
  2. Create a lib directory in the workflow directory.

    hdfs dfs -mkdir -p [/user/dummy/app/lib]
  3. Copy the database JDBC driver jar file to the lib directory.

    hadoop fs -copyFromLocal [/usr/share/java/mysql-connector-java.jar]
  4. Copy the hive-site.xml and tez-site.xml files to a location accessible by the workflow. For example:

    hadoop fs -copyFromLocal [/etc/oozie/conf/action-conf/hive/hive-site.xml /user/dummy/app]
    hadoop fs -copyFromLocal [/etc/oozie/conf/action-conf/hive/tez-site.xml /user/dummy/app]
  5. In the Sqoop action of the workflow, do the following:

    • Add hive-site and tez-site resources in the <file> element of the Sqoop action in the workflow.

    • Include the --hive-import option in the <command> element.

      <command>import --connect [jdbc:mysql://db_host:port/database] --username [user]
       --password [pwd] --driver c[om.mysql.jdbc.Driver] --table [table_name]
      --hive-import -m 1 </command>
  6. Add the following into the file.


More information regarding the Sqoop parameters can be found in the Apache documentation at

Example Workflow Action

Replace all sample text in [square brackets] in the example below with the appropriate workflow name, URI, paths, file names, etc. for your configuration.

<action name="sqoop-node">
      <sqoop xmlns="uri:oozie:sqoop-action:0.2">
            <command>import --connect [jdbc:mysql://db_host:port/database] --username [user]
--password [pwd] --driver [com.mysql.jdbc.Driver] --table [table_name] --hive-import -m 1</command>
      <ok to="end"/>
      <error to="killJob"/>