{"id":79635,"date":"2020-08-26T09:00:08","date_gmt":"2020-08-26T03:30:08","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=79635"},"modified":"2020-08-26T09:00:08","modified_gmt":"2020-08-26T03:30:08","slug":"apache-sqoop-import-mainframe","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/","title":{"rendered":"Significance of Apache Sqoop Import Mainframe Tool"},"content":{"rendered":"<p>The Sqoop Import Mainframe is a tool for importing all the sequential datasets in a partitioned dataset (PDS) on the mainframe to the HDFS. This Sqoop Tutorial first explains what Sqoop Import Mainframe is, its purpose, syntax etc.<\/p>\n<p>Later on, you will explore the possible arguments for this tool. Moreover, the article also covers examples explaining this tool so that you can understand this topic in a better manner.<\/p>\n<p><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/08\/Sqoop-import-mainframe-TV.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-79689\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/08\/Sqoop-import-mainframe-TV.jpg\" alt=\"Sqoop import mainframe\" width=\"1200\" height=\"628\" \/><\/a><\/p>\n<h3>What is Sqoop Import Mainframe?<\/h3>\n<ul>\n<li>Sqoop Import Mainframe is a tool that imports all the sequential datasets in a partitioned dataset (PDS) on the mainframe to the HDFS.<\/li>\n<li>A partitioned dataset (PDS) is similar to a directory in the open systems.<\/li>\n<li>The records in the dataset contain only the character data.<\/li>\n<li>The records are stored with the whole record as the single text field.<\/li>\n<\/ul>\n<h4>Syntax of Sqoop Import Mainframe Tool<\/h4>\n<p>The Syntax for the Sqoop Mainframe tool is:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe (generic-args) (import-args)\n$ sqoop-import-mainframe (generic-args) (import-args)\n<\/pre>\n<p>We can enter the import arguments in any order corresponding to each other, but we have to enter the Hadoop generic arguments before any import arguments.<\/p>\n<p><strong>The common arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;connect &lt;hostname&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This argument specifies the mainframe host to connect to.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;connection-manager &lt;class-name&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">This argument specify the connection manager class which is to use<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hadoop-mapred-home &lt;dir&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Override $HADOOP_MAPRED_HOME<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;help<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will print the usage instructions<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;password-file<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the path for a file which contains the authentication password<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">-P<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will read the password from a console<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;password &lt;password&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Set authentication password<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;username &lt;username&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Set authentication username<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;verbose<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will print more information when working<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;connection-param-file &lt;filename&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Specify the optional properties file which provides the connection parameters<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Let us now explore different steps that one can go through while using the Sqoop Import Mainframe tool.<\/p>\n<h3>Connecting to a Mainframe<\/h3>\n<p>We can use Sqoop for importing mainframe datasets into the HDFS. For doing so, we have to specify the mainframe hostname in a Sqoop &#8211;connect argument.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390<\/pre>\n<p>On entering the above command, we will get connected to the mainframe host z390 via ftp.<br \/>\nSometimes, we have to authenticate against the mainframe host for accessing it. For doing so, we have to supply the username via the &#8211;username option.<\/p>\n<p>There are several different ways available in Sqoop for supplying a password to the mainframe. Some of the Secure ways of supplying password to the mainframe are:<\/p>\n<p><strong>1.<\/strong> We can save the password in a file stored on the user&#8217;s home directory with the 400 permissions. After storing the file, we have to specify the path to that file by using the argument <strong>&#8211;password-file<\/strong>. It is the most preferred method for entering credentials.<\/p>\n<p>Apache Sqoop then reads the password from this file and then passes it to the MapReduce cluster. It does so by using secure means without exposing the password in the job configuration.<\/p>\n<p>This file, which contains the password, can be stored either on the Local FileSystem or on the HDFS.<br \/>\n<strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390 \\\n    --username dataflair --password-file ${user.home}\/.password\n<\/pre>\n<p><strong>2.<\/strong> We can also supply the password by using the -P argument that will read the password from the console prompt.<br \/>\n<strong>Example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390 --username dataflair --password 123\n<\/pre>\n<h3>Selecting the Files to Import<\/h3>\n<p><strong>The Import control arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;as-avrodatafile<\/span><\/td>\n<td><span style=\"font-weight: 400\">Imports data to the Avro Data Files<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;as-sequencefile<\/span><\/td>\n<td><span style=\"font-weight: 400\">Imports data to the SequenceFiles<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;as-textfile<\/span><\/td>\n<td><span style=\"font-weight: 400\">Imports data as a plain text (default)<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;as-parquetfile<\/span><\/td>\n<td><span style=\"font-weight: 400\">Imports data to the Parquet Files<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;delete-target-dir<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will delete an import target directory if the directory exists<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">-m,&#8211;num-mappers &lt;n&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Use <\/span><i><span style=\"font-weight: 400\">n<\/span><\/i><span style=\"font-weight: 400\"> map tasks for importing in parallel<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;target-dir &lt;dir&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">HDFS destination dir<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;warehouse-dir &lt;dir&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">HDFS parent for the table destination<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">-z,&#8211;compress<\/span><\/td>\n<td><span style=\"font-weight: 400\">Enable compression<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;compression-codec &lt;c&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Use the Hadoop codec (default gzip)<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>We can use <strong>&#8211;dataset<\/strong> argument for specifying the partitioned dataset name. All the sequential datasets present in the partitioned dataset will get imported.<\/p>\n<h3>Controlling Parallelism<\/h3>\n<p>Apache Sqoop imports data in parallel by creating multiple ftp connections to the mainframe for transferring multiple files simultaneously.<br \/>\nBy using <strong>-m<\/strong> or <strong>&#8211;num-mappers<\/strong> argument, we can specify the number of mappers (parallel processes) used for performing the import.<\/p>\n<p>Both of these arguments take the integer value corresponding to the degree of parallelism.<br \/>\nSqoop, by default, uses four map tasks. We can adjust this value for maximizing the data transfer rate from the mainframe.<\/p>\n<h3>Controlling Distributed Cache<\/h3>\n<p>Apache Sqoop copies the jars in the <strong>$SQOOP_HOME\/lib<\/strong> folder to the job cache every time while starting a Sqoop job. When we launch it by Oozie, then it is unnecessary because Oozie uses its own Sqoop share lib, which keeps the Sqoop dependencies in a distributed cache.<\/p>\n<p>By using the argument <strong>&#8211;skip-dist-cache<\/strong> in Sqoop command when launched by the Oozie, it will skip the step by which the Sqoop copies all its dependencies to the job cache and save the massive I\/O.<\/p>\n<h3>Controlling the Import Process<\/h3>\n<p>Sqoop, by default, imports all the sequential files present in the partitioned dataset pds to a directory named pds inside the home directory in the HDFS.<br \/>\nFor example, if our username is someuser, then the Sqoop import tool will write to the \/user\/someuser\/pds\/(files).<br \/>\nWe can adjust the parent directory of import with the argument <strong>&#8211;warehouse-dir.<\/strong><\/p>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connnect &lt;host&gt; --dataset foo --warehouse-dir \/shared \\\n    ...\n<\/pre>\n<p>The above command will write to a set of files present in the \/shared\/pds\/ directory.<\/p>\n<p>Also, we can explicitly choose the target directory like:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connnect &lt;host&gt; --dataset foo --target-dir \/dest \\\n    ...\n<\/pre>\n<p>This above command will import the files into a \/dest directory. The argument <strong>&#8211;target-dir<\/strong> is incompatible with the &#8212;<strong>warehouse-dir<\/strong> argument.<br \/>\nThe import, by default, goes to a new target location. If in case the destination directory already exists in the HDFS, then Sqoop will refuse to import and overwrite the content of that directory.<\/p>\n<h3>Sqoop File Formats<\/h3>\n<p>Each record in the dataset is stored as a text record with the newline at the end. It is assumed that each record contains the single text field with the name DEFAULT_COLUMN. When Apache Sqoop imports the data to the HDFS, it generates a Java class that reinterprets the text files that it creates.<\/p>\n<p>We can also import the mainframe records to the Sequence, Parquet, or Avro files. By default, while importing the data is not compressed.<\/p>\n<p>We can compress our data either by using the deflate (gzip) algorithm with the <strong>&#8211;compress<\/strong> or -z argument, or we can specify the Hadoop compression codec by using the <strong>&#8211;compression-codec<\/strong> argument.<\/p>\n<p><strong>The Output line formatting arguments:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;enclosed-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the required field enclosing character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;escaped-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the escape character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;fields-terminated-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the field separator character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;lines-terminated-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the end-of-line character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;mysql-delimiters<\/span><\/td>\n<td><span style=\"font-weight: 400\">Uses the MySQL\u2019s default delimiter set: fields: , lines: \\n escaped-by: \\ optionally-enclosed-by: &#8216;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;optionally-enclosed-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the field enclosing character<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>The Input parsing arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><span style=\"font-weight: 400\">Argument<\/span><\/td>\n<td><span style=\"font-weight: 400\">Description<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;input-enclosed-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sets a required field encloser<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;input-escaped-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sets the input escape character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;input-fields-terminated-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sets the input field separator<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;input-lines-terminated-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sets the input end-of-line character<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;input-optionally-enclosed-by &lt;char&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Sets a field enclosing character<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Importing Data Into Hive<\/h3>\n<p>We use Sqoop mainly for uploading table data into HDFS. But if we have a Hive metastore associated with our HDFS cluster, then also we can use Apache Sqoop.<\/p>\n<p>Sqoop imports the data into the Hive by generating and executing the <strong>CREATE TABLE<\/strong> statement for defining data\u2019s layout in the Hive. We can import data into Hive just by adding the option &#8211;hive-import in our Sqoop command line.<\/p>\n<p>If in case the Hive table already exists, then we can specify <strong>&#8211;hive-overwrite<\/strong> option that indicates the replacement of the already existing table in hive.<\/p>\n<p>When the Sqoop job wants to import data into HDFS, then Sqoop will generate the Hive script that contains the CREATE TABLE operation that defines our columns using the Hive\u2019s types, and the <strong>LOAD DATA INPATH<\/strong> statement for moving data files into the Hive\u2019s warehouse directory.<\/p>\n<p>This script is executed by calling an installed copy of Hive on the machine where Sqoop is running. If we have multiple Hive installations, or the hive is not in our $PATH, then we use the option <strong>&#8211;hive-home<\/strong> for identifying Hive installation directory. Apache Sqoop will use <strong>$HIVE_HOME\/bin\/hive<\/strong> from here.<\/p>\n<p>We can import data for Hive into the particular partition by specifying the arguments, &#8211;hive-partition-key and &#8211;hive-partition-value arguments.<\/p>\n<p>By using the <strong>&#8211;compress<\/strong> and <strong>&#8211;compression-codec<\/strong> options, we can import compressed tables into the Hive.<\/p>\n<p><strong>The Hive arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-home &lt;dir&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Override $HIVE_HOME<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-import<\/span><\/td>\n<td><span style=\"font-weight: 400\">Import tables into Hive. It uses the Hive\u2019s default delimiters if none are set.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-overwrite<\/span><\/td>\n<td><span style=\"font-weight: 400\">Overwrite the existing data in the Hive table.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;create-hive-table<\/span><\/td>\n<td><span style=\"font-weight: 400\">If we set this option, then the Sqoop job will fail if a target hive table exits. This property, by default, is set to false.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-table &lt;table-name&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set a table name to use while importing to Hive.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-drop-import-delims<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will drop the <\/span><i><span style=\"font-weight: 400\">\\n<\/span><\/i><span style=\"font-weight: 400\">, <\/span><i><span style=\"font-weight: 400\">\\r<\/span><\/i><span style=\"font-weight: 400\">, and <\/span><i><span style=\"font-weight: 400\">\\01<\/span><\/i><span style=\"font-weight: 400\"> from the string fields while importing to Hive.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-delims-replacement<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will replace the <\/span><i><span style=\"font-weight: 400\">\\n<\/span><\/i><span style=\"font-weight: 400\">, <\/span><i><span style=\"font-weight: 400\">\\r<\/span><\/i><span style=\"font-weight: 400\">, and <\/span><i><span style=\"font-weight: 400\">\\01<\/span><\/i><span style=\"font-weight: 400\"> from the string fields with the user defined string while importing to Hive.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-partition-key<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will specify the name of the hive field to which the partition are sharded on<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hive-partition-value &lt;v&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will specify the String-value which serves as a partition key for this imported into the hive in this job.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;map-column-hive &lt;map&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Override the default mapping from the SQL type to the Hive type for the configured columns.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Importing Data Into HBase<\/h3>\n<p>Apache Sqoop can import the records into the table in HBase as well. For importing a table to HBase instead of any directory in HDFS, we have to specify the <strong>&#8211;hbase-table<\/strong> option in the Sqoop command.<\/p>\n<p>Apache Sqoop will import the data to a table specified as an argument to the &#8211;hbase-table option. Each row of an input table is transformed into the HBase Put operation to the row of the output table. For each row, it takes the key from the column of the input.<\/p>\n<p>Sqoop, by default, uses a split-by column as a row key column.<\/p>\n<p>If the split-by column is not specified, then it will try to find the primary key column. We can also manually specify the row key column with the <strong>&#8211;hbase-row-key<\/strong>. Every output column is placed in the same column family specified with <strong>&#8211;column-family<\/strong>.<\/p>\n<p>While importing data into HBase, if the target table and the column family don\u2019t exist, then the Sqoop job exits with an error.<\/p>\n<p>So if you are importing using the &#8211;hbase-table option, then you have to create the target table and the column family before running the import.<br \/>\nIf we specify the option <strong>&#8211;hbase-create-table<\/strong>, then the Sqoop will itself create the target table and the column family if they don\u2019t exist.<\/p>\n<p><strong>The HBase arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;column-family &lt;family&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set a target column family for the import<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hbase-create-table<\/span><\/td>\n<td><span style=\"font-weight: 400\">If we specify this option then it will create missing HBase tables.\u00a0<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hbase-row-key &lt;col&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will specify which input column to be used as a row key. If the input table contains a composite key, then in such as case the&lt;col&gt; must be in the form of the comma-separated list of the composite key attributes<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hbase-table &lt;table-name&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will Specify an HBase table to be used as a target instead of HDFS<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;hbase-bulkload<\/span><\/td>\n<td><span style=\"font-weight: 400\">Enables bulk loading<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>Importing Data Into Accumulo<\/h3>\n<p>Apache Sqoop also provides support for importing records into the table in Accumulo. We can import data to Accumulo by specifying <strong>&#8211;accumulo-table<\/strong> option. Apache Sqoop imports the data to a table specified as an argument to the &#8211;accumulo-table.<\/p>\n<p>Each row of an input table is transformed into the Accumulo Mutation operation to the row of an output table. For each row, the key is taken from the column of the input. Sqoop, by default, uses the split-by column as a row key column.<\/p>\n<p>If the split-by column is not specified, then it tries to find the primary key column. We can also manually specify a row key column via <strong>&#8211;accumulo-row-key<\/strong>.<\/p>\n<p>Each output column has to be placed in the same column family specified with &#8212;<strong>accumulo-column-family<\/strong>.<br \/>\nSpecify the &#8211;accumulo-create-table parameter if you have not created a target table.<\/p>\n<p><strong>The Accumulo arguments are:<\/strong><\/p>\n<table>\n<tbody>\n<tr>\n<td><b>Argument<\/b><\/td>\n<td><b>Description<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-table &lt;table-nam&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will specify the Accumulo table to be used as the target instead of the HDFS<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-column-family &lt;family&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will set the target column family for the import<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-create-table<\/span><\/td>\n<td><span style=\"font-weight: 400\">If specified, then it will create the missing Accumulo tables.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-row-key &lt;col&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It will specify which input column to use as the row key.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-visibility &lt;vis&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is Optional.\u00a0 It will specify the visibility token to be applied to all the rows inserted into Accumulo. The default value is the empty string.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-batch-size &lt;size&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is optional. It will set the size of Accumulo\u2019s writer buffer in bytes. The default is 4MB.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-max-latency &lt;ms&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">It is Optional. It will set the maximum latency in the milliseconds for the Accumulo batch writer. The default value is set to 0.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-zookeepers &lt;host:port&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Specify the comma-separated list of the Zookeeper servers used by Accumulo instance<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-instance &lt;table-name&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Specify the name of a target Accumulo instance<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-user &lt;username&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Specify the name of Accumulo user to import as<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400\">&#8211;accumulo-password &lt;password&gt;<\/span><\/td>\n<td><span style=\"font-weight: 400\">Specify the password for Accumulo user<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>For performance tuning, we have to use the optional <strong>&#8211;accumulo-buffer-size\\<\/strong> and <strong>&#8211;accumulo-max-latency<\/strong> parameters.<\/p>\n<h3>Additional Import Configuration Properties<\/h3>\n<p>There are some additional properties which we can configure by modifying the <strong>conf\/sqoop-site.xml<\/strong> file. We can specify the properties in the same manner as we do in Hadoop configuration files.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&lt;property&gt;\n    &lt;name&gt;property.name&lt;\/name&gt;\n    &lt;value&gt;property.value&lt;\/value&gt;\n  &lt;\/property&gt;\n<\/pre>\n<p>We can also specify it on the command line in the generic arguments.<\/p>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sqoop import -D property.name=property.value ...<\/pre>\n<h3 class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Example Invocations of Sqoop Import Mainframe<\/h3>\n<p>The below examples will illustrate how we can use the Sqoop import tool in a variety of situations.<\/p>\n<p><strong>1:<\/strong> In this example we are trying to import all the sequential files present in a partitioned dataset named EMP in the mainframe host z390:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390 --dataset EMP \\\n    --username SomeUser -P\nEnter password: (hidden)\n<\/pre>\n<p><strong>2:<\/strong> We are trying to control the import parallelism, that is, setting number of mappers to 8 :<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390 --dataset EMP \\\n    --username SomeUser --password-file mypassword -m 8\n<\/pre>\n<p><strong>3:<\/strong> In this example, we are trying to import the data to Hive:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">$ sqoop import-mainframe --connect z390 --dataset EMP \\\n    --hive-import\n<\/pre>\n<h3>Summary<\/h3>\n<p>I hope after reading this Sqoop Import Mainframe article, you clearly understand how we can import all the sequential datasets in a partitioned dataset (PDS) on the mainframe to the HDFS.<\/p>\n<p>The article had also explained how we can import data to Hive, HBase, and Accumulo. We have discussed the Sqoop Import Mainframe tool along with its purpose and syntax.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Sqoop Import Mainframe is a tool for importing all the sequential datasets in a partitioned dataset (PDS) on the mainframe to the HDFS. This Sqoop Tutorial first explains what Sqoop Import Mainframe is,&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":79689,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3163],"tags":[3195,3196],"class_list":["post-79635","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sqoop","tag-sqoop-import-mainframe-tool-examples","tag-sqoop-import-mainframe-tool-purpose"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Significance of Apache Sqoop Import Mainframe Tool - TechVidvan<\/title>\n<meta name=\"description\" content=\"Apache Sqoop Import Mainframe tool - Learn how to import sequential datasets in a partitioned dataset (PDS) on mainframe to HDFS, Hive, HBase &amp; Accumulo\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Significance of Apache Sqoop Import Mainframe Tool - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"Apache Sqoop Import Mainframe tool - Learn how to import sequential datasets in a partitioned dataset (PDS) on mainframe to HDFS, Hive, HBase &amp; Accumulo\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-26T03:30:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Significance of Apache Sqoop Import Mainframe Tool - TechVidvan","description":"Apache Sqoop Import Mainframe tool - Learn how to import sequential datasets in a partitioned dataset (PDS) on mainframe to HDFS, Hive, HBase & Accumulo","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/","og_locale":"en_US","og_type":"article","og_title":"Significance of Apache Sqoop Import Mainframe Tool - TechVidvan","og_description":"Apache Sqoop Import Mainframe tool - Learn how to import sequential datasets in a partitioned dataset (PDS) on mainframe to HDFS, Hive, HBase & Accumulo","og_url":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-08-26T03:30:08+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"Significance of Apache Sqoop Import Mainframe Tool","datePublished":"2020-08-26T03:30:08+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/"},"wordCount":2459,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg","keywords":["Sqoop Import Mainframe Tool examples","Sqoop Import Mainframe Tool purpose"],"articleSection":["Sqoop Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/","url":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/","name":"Significance of Apache Sqoop Import Mainframe Tool - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg","datePublished":"2020-08-26T03:30:08+00:00","description":"Apache Sqoop Import Mainframe tool - Learn how to import sequential datasets in a partitioned dataset (PDS) on mainframe to HDFS, Hive, HBase & Accumulo","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/08\/Sqoop-import-mainframe-TV.jpg","width":1200,"height":628,"caption":"Sqoop import mainframe"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/apache-sqoop-import-mainframe\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Significance of Apache Sqoop Import Mainframe Tool"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79635","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=79635"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/79635\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/79689"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=79635"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=79635"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=79635"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}