Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Import Sqoop as textfile

Solved Go to solution
Highlighted

Import Sqoop as textfile

Rising Star

Hey everyone,

I'm new in Sqoop I'm trying to import from MySQL to a text file using a query , my sqoop command is:

sqoop import --connect jdbc:mysql://master/poc --username root --query 'SELECT * FROM table WHERE $CONDITIONS' --split-by field --target-dir /user/hdfs/mysql --as-textfile -m 1;

The problem is that , when y job finish i run hdfs dfs -ls /user/hdfs/mysql and i see just the file success and the part* but any txt so, I dont know what i'm missing. can some one give me a hand to complete my statement.

thanks so much

AU

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Import Sqoop as textfile

Rising Star

Actually guys i have realized in Sqoop documentation that this output file is the default so yeah this is the txt form. thanks so much. I'm going to close this thread. official info here https://sqoop.apache.org/docs/1.4.1-incubating/SqoopUserGuide.html

View solution in original post

5 REPLIES 5
Highlighted

Re: Import Sqoop as textfile

Hi @Andres Urrego

Are you able to see any other files which starts with part_m_* in that folder? Those are the text files which you have imported from MySQL

Highlighted

Re: Import Sqoop as textfile

Rising Star

Hi buddy yes actually i got a file part-m-00000, then when i perform a -cat i get the results from my query but so that means that i will never get a .txt so is just convert this part to txt extention? thanks

Re: Import Sqoop as textfile

Rising Star

Actually guys i have realized in Sqoop documentation that this output file is the default so yeah this is the txt form. thanks so much. I'm going to close this thread. official info here https://sqoop.apache.org/docs/1.4.1-incubating/SqoopUserGuide.html

View solution in original post

Highlighted

Re: Import Sqoop as textfile

New Contributor

Hi Andres,

Is your -cat result plain text? I'm getting un-readble characters. Hope you can share some info to correct my import command.

Thanks,

Andrew

Highlighted

Re: Import Sqoop as textfile

New Contributor

@Andres Urrego

Can you cat the output file?

Don't have an account?
Coming from Hortonworks? Activate your account here