Support Questions

Find answers, ask questions, and share your expertise

Import Sqoop as textfile

avatar
Expert Contributor

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

avatar
Expert Contributor

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

avatar

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

avatar
Expert Contributor

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

avatar
Expert Contributor

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

avatar
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

avatar
New Contributor

@Andres Urrego

Can you cat the output file?