Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

*Closed* : How to import mutilple tables (not all tables) in Sqoop

avatar
Contributor

Hi all,

I want to import specific tables from MsSQL to HIVE database. Although I have tried --exclude-tables arguments for excluding some table while importing.

But my scenario is a little bit different.

For Example, If I have 100 tables and I want to import only 98 tables then I could exclude those 2 tables using --exclude-tables argument. But what if I want to import only 2 tables among those 100 tables.

I tried to give multiple tables names in --table argument.

My observation:

import-all-tables
--connect
jdbc:sqlserver://<HOST>:<port>;databasename=<mssql_database_name>
--username
xxxxx
--password
xxxx
--table
mssql_table1,mssql_table2
--hive-import
--hive-database
<hive_database_name>
--fields-terminated-by
","
-m
1

Does anyone have an idea?

Regards,

Jay.

1 ACCEPTED SOLUTION

avatar
Master Guru
@JAy PaTel

One way of doing is using --exclude-tables argument and mentioning all the tables with comma separated values.

(or)

Writing shell script to to have the required two tables and iterating sqoop job on these tables.

Please refer to this and this links for more details.

View solution in original post

12 REPLIES 12

avatar
Master Mentor

@JAy PaTel

If that is the case you might need to script it in advance see using Sqoop to fetch many tables in parallel

Hope that helps

avatar
Master Mentor

@JAy PaTel

Can you share your sqoop code,please remember to obfuscate sensitive info?

avatar
Contributor

Hi @Geoffrey Shelton Okot,

Please have a look into my sqoop code.

sqoop import --connect jdbc:sqlserver://<HOST>:<PORT>;databasename=<mssql_database_nameMS> --username xxxx --password xxxx --hive-database <hive_database_name> --table <mssql_table1>,<mssql_table2> --hive-import -m 1

Thank you,

Jay.