0
votes

I have tried below to import from netezza table to hdfs ,

sqoop import --connect <***> \
--username *** \
--password *** \
--query "select * from table_name LIMIT 5" \
--split-by col_name \
--fields-terminated-by '\t' \
--input-null-string '\\N' \
--target-dir /path

Error is - ERROR

tool.ImportTool: Import failed: java.io.IOException: Query [select * from ADMIN.ORANGE_FF_PRMNC_DLY_MV WHERE \ LIMIT 5] must contain '$CONDITIONS' in WHERE clause. then i have tried

 --query "select * from table_name WHERE \\$CONDITIONS LIMIT 5" \

still getting error.

2
Try "... WHERE \$CONDITIONS". Do you still get the same error message? - user4601931
Is definitely not a netezza database error message - says JAVA, so I guess it's the sqoop libraries that tries to 'parse' the (perfectly legal) Netezza SQL. Try --query "select * from table_name where 1=1 LIMIT 5" \ - Lars G Olsen

2 Answers

0
votes

You can specify two options:

  1. Double quotes and scaping dollar: "select ... where rownum <=5 AND \$CONDITIONS"
  2. Simple quote 'select ... where rownum <=5 AND $CONDITIONS'
0
votes

Add "\$CONDITIONS" to the query before limit.

For example:

sqoop import --connect jdbc:netezza://****:5480/DB_NAME --username *** --password **** --target-dir /tmp/*****/ --query "select * from tablename where \$CONDITIONS limit 5"