Support Questions

Find answers, ask questions, and share your expertise

hive import from sql server?

avatar
Rising Star
 
1 ACCEPTED SOLUTION

avatar
Expert Contributor

You need use sqoop for direct import on hive form sql.

First download sql jdbc https://www.microsoft.com/en-us/download/details.aspx?id=11774

place jar on sqoop master server: /usr/hdp/current/sqoop-server/lib

use this command for import:

import --connect jdbc:sqlserver://[SQL_SERVER_NAME]:[SQL_PORT]/[DB-NAME] --username "[SQL_USERNAME]" --password "[PASSWORD]" --query '[INSERT QUERY HERE] WHERE $CONDITIONS' -m 1 --hive-import --hive-database [DB_HIVE] --create-hive-table --hive-table [HIVE_TABLE]

if use --query you must have WHERE $CONDITIONS on query.

View solution in original post

3 REPLIES 3

avatar
Expert Contributor

You can simply use sqoop

avatar
Expert Contributor

avatar
Expert Contributor

You need use sqoop for direct import on hive form sql.

First download sql jdbc https://www.microsoft.com/en-us/download/details.aspx?id=11774

place jar on sqoop master server: /usr/hdp/current/sqoop-server/lib

use this command for import:

import --connect jdbc:sqlserver://[SQL_SERVER_NAME]:[SQL_PORT]/[DB-NAME] --username "[SQL_USERNAME]" --password "[PASSWORD]" --query '[INSERT QUERY HERE] WHERE $CONDITIONS' -m 1 --hive-import --hive-database [DB_HIVE] --create-hive-table --hive-table [HIVE_TABLE]

if use --query you must have WHERE $CONDITIONS on query.