Reputation: 8144
I have a table in hive and i have created a view for it. say for example
My table has the following fields
id | name | city | state | county | country
My view is like this Id | name | country
Now i need to export those values [ from view ] to sql server How can i export data from hive to sql server using view Is there any way ?
and i have been exporting to sql using the
sqoop export --connect "jdbc:sqlserver://XXXXXX;username=YYY;password=ZZZZZ;database=AdventureWorksDW" --table sqlg --export-dir /hive/datawarehouse/sql -m 1 -input-fields-terminated-by "^"
but now i need to export using view
Thanks
UPDATE :
My .csv files is like below in HDFS
1^hari^XX^xx^yy^zz
2^migi^na^na^na^na
But i need to load only
1^hari^zz
2^migi^na
into SQL table
Upvotes: 2
Views: 5819
Reputation: 1221
try
sqoop export --connect "jdbc:sqlserver://172.16.2.182;username=sa;password=1timep;database=AdventureWorksDW" --table sqlg --export-dir /hive/datawarehouse/sql -m 1 -input-fields-terminated-by "^" --columns "Id,name,country" --update-key "Id"
Upvotes: 1
Reputation: 33495
The same Sqoop command should work for both table and a view. Check the Sqoop documentation (1) on the same.
Upvotes: 0