<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208460#M79156</link>
    <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271"&gt;@Geoffrey Shelton Okot&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Please have a look into my sqoop code.&lt;/P&gt;&lt;PRE&gt;sqoop import --connect jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;;databasename=&amp;lt;mssql_database_nameMS&amp;gt; --username xxxx --password xxxx --hive-database &amp;lt;hive_database_name&amp;gt; --table &amp;lt;mssql_table1&amp;gt;,&amp;lt;mssql_table2&amp;gt; --hive-import -m 1&lt;/PRE&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jun 2018 20:13:27 GMT</pubDate>
    <dc:creator>pateljay</dc:creator>
    <dc:date>2018-06-22T20:13:27Z</dc:date>
    <item>
      <title>*Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208449#M79145</link>
      <description>&lt;P&gt;Hi all, &lt;/P&gt;&lt;P&gt;I want to import specific tables from MsSQL to HIVE database. Although I have tried&lt;STRONG&gt; --exclude-tables&lt;/STRONG&gt; arguments for excluding some table while importing. &lt;/P&gt;&lt;P&gt;But my scenario is a little bit different. &lt;/P&gt;&lt;P&gt;&lt;EM&gt;For Example,&lt;/EM&gt; If I have 100 tables and I want to import only 98 tables then I could exclude those 2 tables using &lt;STRONG&gt;--exclude-tables&lt;/STRONG&gt; argument. But what if I want to import only 2 tables among those 100 tables. &lt;/P&gt;&lt;P&gt;I tried to give multiple tables names in &lt;STRONG&gt;--table&lt;/STRONG&gt; argument. &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My observation:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;import-all-tables
--connect
jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;port&amp;gt;;databasename=&amp;lt;mssql_database_name&amp;gt;
--username
xxxxx
--password
xxxx
--table
mssql_table1,mssql_table2
--hive-import
--hive-database
&amp;lt;hive_database_name&amp;gt;
--fields-terminated-by
","
-m
1&lt;/PRE&gt;&lt;P&gt;Does anyone have an idea? &lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 19:40:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208449#M79145</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-04T19:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208450#M79146</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/17868/jay.html" nodeid="17868"&gt;@JAy  PaTel&lt;/A&gt;&lt;P&gt;One way of doing is using &lt;STRONG&gt;--exclude-tables &lt;/STRONG&gt;argument and mentioning all the tables with comma separated values.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Writing shell script to to have the required two tables and iterating sqoop job on these tables.&lt;/P&gt;&lt;P&gt;Please refer to &lt;A href="https://community.hortonworks.com/content/kbentry/23602/sqoop-fetching-lot-of-tables-in-parallel.html" target="_blank"&gt;this&lt;/A&gt; and &lt;A href="https://stackoverflow.com/questions/34966626/how-to-import-the-data-from-multiple-source-thru-sqoop/34985029#34985029"&gt;this&lt;/A&gt; links for more details.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 20:04:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208450#M79146</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-04T20:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208451#M79147</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;A href="@JAy PaTel"&gt; @JAy PaTel&lt;/A&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;When you want to import ONLY a subset of the database you don't use "&lt;STRONG&gt;import-all-tables&lt;/STRONG&gt;"&lt;/EM&gt;&lt;/P&gt;&lt;PRE&gt; $ sqoop import 
--connect jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;port&amp;gt;;databasename=&amp;lt;mssql_database_name&amp;gt;
--username foo 
--password  foo
--table mssql_table1,mssql_table2 
--hive-import&lt;/PRE&gt;&lt;P&gt;&lt;EM&gt;Please try the above method and revert&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 20:11:31 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208451#M79147</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-06-04T20:11:31Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208452#M79148</link>
      <description>&lt;P&gt;Hi, &lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271"&gt;@Geoffrey Shelton Okot&lt;/A&gt;, thanks&lt;/P&gt;&lt;P&gt;Yes , I tried --exclude-tables argument to exclude some of the tables. But what if I want to import only 2 tables out of 100 tables from MsSQL to Hive database. Do I need to mention all 98 tables names in --exclude-tables argument?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 20:44:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208452#M79148</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-04T20:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208453#M79149</link>
      <description>&lt;P&gt;&lt;EM&gt; &lt;A href="https://community.hortonworks.com/questions/194444/@JAy%20PaTel"&gt;@JAy PaTel&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Why go the lengthy tedious way to exclude 98 tables when you can just mention the 2 tables you want imported?&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 20:48:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208453#M79149</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-06-04T20:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208454#M79150</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271"&gt;@Geoffrey Shelton Okot&lt;/A&gt;, thank you, &lt;/P&gt;&lt;P&gt;But 98 is just a number. Let's think about bigger number and change scenario. &lt;/P&gt;&lt;P&gt;What if MsSQL database has 500 tables and I want to import only 100 tables among them? Do I need to mention those all 100 tables in &lt;STRONG&gt;--table &lt;/STRONG&gt;argument? &lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 20:55:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208454#M79150</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-04T20:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208455#M79151</link>
      <description>&lt;P&gt;Hey &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;, I have gone through both links which you have given.&lt;/P&gt;&lt;P&gt;This &lt;A href="https://stackoverflow.com/questions/34966626/how-to-import-the-data-from-multiple-source-thru-sqoop/34985029#34985029" target="_blank"&gt; link&lt;/A&gt; this for "how to import data from multiple &lt;STRONG&gt;source &lt;/STRONG&gt;thru Sqoop?" &lt;/P&gt;&lt;P&gt;In this &lt;A href="https://community.hortonworks.com/content/kbentry/23602/sqoop-fetching-lot-of-tables-in-parallel.html" target="_blank"&gt; link&lt;/A&gt;, there is no idea about import only specific tables using Sqoop.  They created script for importing tables and aslo mentioning those 100 tables names. i.e., table1, table2,table3,table4,table5,table6,... show on. &lt;BR /&gt;But I don't want to mention those all tables names.&lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 21:02:45 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208455#M79151</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-04T21:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208456#M79152</link>
      <description>&lt;P&gt;&lt;EM&gt; &lt;A href="https://community.hortonworks.com/questions/194444/@JAy%20PaTel"&gt;@JAy PaTel&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;If that is the case you might need to script it in advance see &lt;A href="https://community.hortonworks.com/articles/23602/sqoop-fetching-lot-of-tables-in-parallel.html" target="_blank"&gt; using Sqoop to fetch many tables in parallel&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Hope that helps&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 21:06:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208456#M79152</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-06-04T21:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208457#M79153</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/17868/jay.html" nodeid="17868"&gt;@JAy  PaTel&lt;/A&gt;&lt;P&gt;Let me explain how to do your case using Shell script&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;1.Using whileloop:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Create a input file with all the required tables i.e &lt;/P&gt;&lt;PRE&gt;bash$ vi required_tables.txt&lt;BR /&gt;mssql_table1&lt;BR /&gt;mssql_table2&lt;/PRE&gt;&lt;P&gt;Then the shell script will read the above file data line by line and executes sqoop import for each table&lt;/P&gt;&lt;PRE&gt;bash$ vi sqoop_import_while.sh&lt;BR /&gt;while read line;
do
    tableName=`echo $line | cut -d'.' -f2`
    sqoop import --connect jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;port&amp;gt;;databasename=&amp;lt;mssql_database_name&amp;gt; --username xxxxx -    -password xxxx --table $tableName --hive-import --hive-database &amp;lt;hive_database_name&amp;gt; --fields-terminated-by ',' -m 1
done &amp;lt;/home/required_table.txt(give your required_tables.txt file path)&lt;/PRE&gt;&lt;P&gt;Now the script reads each &lt;STRONG&gt;line&lt;/STRONG&gt; from required_table.txt file and assigns the value to &lt;STRONG&gt;tableName &lt;/STRONG&gt;variable then we are using  tableName variable in our sqoop import staetment. &lt;/P&gt;&lt;P&gt;Once the import is finished for the first table then script reads the next line and performs import again for the second table.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;2.Using Forloop:&lt;/U&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;bash$ vi sqoop_import_for.sh
declare -a req_tables=("mssql_table1" "mssql_table2")
for t in "${req_tables[@]}"
do
	sqoop import --connect jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;port&amp;gt;;databasename=&amp;lt;mssql_database_name&amp;gt; --username xxxxx --password xxxx --table $t --hive-import --hive-database &amp;lt;hive_database_name&amp;gt; --fields-terminated-by ',' -m 1
done&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;By using this script we are not reading the table names from the file instead we are &lt;STRONG&gt;defining an array variable&lt;/STRONG&gt; and iterating through all the array elements and performing sqoop import.&lt;/P&gt;&lt;P&gt;We have defined &lt;STRONG&gt;req_tables &lt;/STRONG&gt;array and given all the required tables then performing &lt;STRONG&gt;for loop&lt;/STRONG&gt; each table in &lt;STRONG&gt;req_tables&lt;/STRONG&gt; array and passing the name to &lt;STRONG&gt;--table&lt;/STRONG&gt; argument in sqoop import.&lt;/P&gt;&lt;P&gt;give the permissions to the shell script file then execute the script by using&lt;STRONG&gt; ./sqoop_import_for.sh (or) ./sqoop_import_while.sh&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can choose either of the above ways to import only the required tables using sqoop.&lt;/P&gt;&lt;P&gt;Let us know if you are facing issues ..!!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 08:22:24 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208457#M79153</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-06-05T08:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208458#M79154</link>
      <description>&lt;P&gt;hi &lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271"&gt;@Geoffrey Shelton Okot&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I tried above solution, but it is also throwing below error;&lt;/P&gt;&lt;PRE&gt;18/06/22 11:53:59 ERROR manager.SqlManager: Error executing statement: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name '&amp;lt;ms_SQL_tbalename&amp;gt;,&amp;lt;ms_SQl_Tablename&amp;gt;'.&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 18:56:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208458#M79154</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-22T18:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208459#M79155</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;A href="https://community.hortonworks.com/questions/194444/@JAy%20PaTel"&gt;@JAy PaTel&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;A href="https://community.hortonworks.com/questions/194444/@JAy%20PaTel"&gt;&lt;/A&gt;Can you share your sqoop code,please remember to obfuscate sensitive  info?&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 20:01:34 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208459#M79155</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2018-06-22T20:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208460#M79156</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/1271/sheltong.html" nodeid="1271"&gt;@Geoffrey Shelton Okot&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Please have a look into my sqoop code.&lt;/P&gt;&lt;PRE&gt;sqoop import --connect jdbc:sqlserver://&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;;databasename=&amp;lt;mssql_database_nameMS&amp;gt; --username xxxx --password xxxx --hive-database &amp;lt;hive_database_name&amp;gt; --table &amp;lt;mssql_table1&amp;gt;,&amp;lt;mssql_table2&amp;gt; --hive-import -m 1&lt;/PRE&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 20:13:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208460#M79156</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-06-22T20:13:27Z</dc:date>
    </item>
    <item>
      <title>Re: *Closed* : How to import mutilple tables (not all tables) in Sqoop</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208461#M79157</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929"&gt;@Shu&lt;/A&gt;&lt;P&gt;Thank a ton !!!&lt;/P&gt;&lt;BLOCKQUOTE&gt;I would like to suggest to use &lt;STRONG&gt;While Loop. &lt;/STRONG&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jay.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 14:59:11 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Closed-How-to-import-mutilple-tables-not-all-tables-in-Sqoop/m-p/208461#M79157</guid>
      <dc:creator>pateljay</dc:creator>
      <dc:date>2018-07-06T14:59:11Z</dc:date>
    </item>
  </channel>
</rss>

