Support Questions
Find answers, ask questions, and share your expertise

Sqoop import from sql server to hive

New Contributor

Hi guys,

I am trying to accomplish the below task and i need you guidance to proceed in the correct direction.


sqoop import --connect 'jdbc:jtds:sqlserver://servernamecom:1433/databasename;useNTLMv2=true;domain=ABC;ssl=require'
--connection-manager org.apache.sqoop.manager.SQLServerManager
--driver net.sourceforge.jtds.jdbc.Driver
--username $USER
--query "SELECT * FROM [databasename].[dbo].[abc] (NOLOCK) WHERE createdate< 2019-01-01 and  batchid in (select top 1 batch_id from batch where date=getdate() and status=1) AND \$CONDITIONS AND \$CONDITIONS"
--hive-database test
--hive-table table
--target-dir maprfs:///user/abc/Folder
--delete-target-dir --split-by KEY

Once the import finished successfully i need to update status from 1 to 2 in batch table in sql server table and delete the data from source table abc for that batchid.

We are doing this to archive data based on createdate .