Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Sqoop export create a new table?

It is possible to export data from HDFS to RDBMS table using Sqoop. But it seems like we need to have existing table.

Is there some parameter to tell Sqoop do the 'CREATE TABLE' thing and export data to this newly crated table?

If yes, is it going to work with Oracle?

like image 629
Bohdan Avatar asked Apr 15 '13 22:04

Bohdan


People also ask

How do I export data from Sqoop?

Sqoop - Export. Those are read and parsed into a set of records and delimited with user-specified delimiter. The default operation is to insert all the record from the input files to the database table using the INSERT statement. In update mode, Sqoop generates the UPDATE statement that replaces the existing record into the database.

Is it possible to export data from HDFS to RDBMS using Sqoop?

Bookmark this question. Show activity on this post. It is possible to export data from HDFS to RDBMS table using Sqoop. But it seems like we need to have existing table. Is there some parameter to tell Sqoop do the 'CREATE TABLE' thing and export data to this newly crated table? If yes, is it going to work with Oracle? Show activity on this post.

What is templatetablename in Sqoop Export?

TemplateTableName is a table that exists in Oracle prior to executing the Sqoop command. ps. You'll have to use --direct sqoop export option to activate sqoop direct mode = 'Data Connector for Oracle and Hadoop' (aka OraOOP - older name).

How to import table from MySQL to Hadoop file system?

This tip gives basic commands to import table from Mysql to Hadoop File system and Import the files from HDFS back to Mysql. Sqoop is basically used to Import data from RDBMS system to Hadoop distributed File system (HDFS). And for Exporting data from HDFS back to RDBMS, Sqoop is used.


2 Answers

You can actually execute arbitrary SQL queries and DDL via sqoop eval, at least with MySQL and MSSQL. I'd expect it to work with Oracle as well. MSSQL example:

sqoop eval --connect 'jdbc:sqlserver://<DB SERVER>:<DB PORT>;
database=<DB NAME>'  --query "CREATE TABLE..."
--username <USERNAME> -P
like image 36
Paul Back Avatar answered Oct 23 '22 13:10

Paul Back


I'm afraid that Sqoop do not support creating tables in the RDBMS at the moment. Sqoop uses the table in RDBMS to get metadata (number of columns and their data types), so I'm not sure where Sqoop could get the metadata to create the table for you.

like image 82
Jarek Jarcec Cecho Avatar answered Oct 23 '22 11:10

Jarek Jarcec Cecho