As stated earlier, Sqoop is a bi-directional connector. Sqoop's export process will read a set of delimited text files from HDFS in parallel, parse them into records, and insert them as new rows in a target database table. The following examples export data from HDFS and Hive to SQL Server. The assumption is that you are running the commands from the $SQOOP_HOME
directory on the master node of the Hadoop cluster, where Sqoop is installed.
When using the sqoop export
command, you must specify the following mandatory arguments:
--connect
argument specifying the connection string to the SQL Server database--username
and--password
arguments to provide valid credentials to connect to the SQL Server database--table
or--call
argument to export to an SQL table or invoke a stored procedure call--export-dir
argument to specify the HDFS directory to export
The following command exports data back from a delimited text file in /data/ErrorLogs
on HDFS to ErrorLog
table in Adventureworks2012...