Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

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.