Search code examples
sql-serverhivesqoop

How to Sqoop CDC system tables from sql server


I'm able to pull tables from sql server using sqoop command:

Sql database: MyDB sql table: dbo.TestTable

sqoop import  
     -connect 'jdbc:sqlserver://xx.xxx.xxx.xxx;database=MyDB' 
     --username Cread -P 
     --table TestTable 
     --hcatalog-database  default 
     --hcatalog-table testTable_hive   
     --create-hcatalog-table  
     --hcatalog-storage-stanza "stored as orc"

Now i'm trying to pull CDC table cdc.dbo_TestTable_CT in MyDB sql database.

sqoop import  
     -connect 'jdbc:sqlserver://xx.xxx.xxx.xxx;database=MyDB' 
     --username Cread -P 
     --table cdc.TestTable_CT
     --hcatalog-database  default 
     --hcatalog-table testTable_hive   
     --create-hcatalog-table  
     --hcatalog-storage-stanza "stored as orc"

it is throwing an error invalid object name. Looks like by default it is looking in dbo and not able to find cdc tables.

Can someone please help me how to pull CDC tables?

Thanks.


Solution

  • Did you try just passing the schema like this?

     sqoop import  
         -connect 'jdbc:sqlserver://xx.xxx.xxx.xxx;database=MyDB' 
         --username Cread -P 
         --table TestTable_CT
         -- --schema cdc
         --hcatalog-database  default 
         --hcatalog-table testTable_hive   
         --create-hcatalog-table  
         --hcatalog-storage-stanza "stored as orc"