hadoop - How to specify multiple conditions in sqoop? -


sqoop version: 1.4.6.2.3.4.0-3485

i have been trying import data using sqoop using following command:

sqoop import -libjars /usr/local/bfm/lib/java/jconnect-6/6.0.0/jconn3-6.0.0.jar --connect jdbc:sybase:db --username user --password 'pwd' --driver com.sybase.jdbc3.jdbc.sybdriver --query 'select  a.* table1 a,table2 b b.run_group=a.run_group  , a.date<"7/22/2016" , $conditions' --target-dir /user/user/a/ --verbose --hive-import --hive-table default.temp_a --split-by id 

i following error:

invalid column name '7/22/2016' 

i have tried enclosing query in double quotes, says:

conditions: undefined variable. 

tried several combinations of single/double quotes , escaping $conditions , using --where switch well.

ps: conditions non numeric. (it works cases x<10 or so, not in case it's string or date)

in command --split-by=id should --split-by=a.id, use join instead of adding where condition, convert date (specified string value) varchr (using sybase specific function)

sqoop import -libjars /usr/local/bfm/lib/java/jconnect-6/6.0.0/jconn3-6.0.0.jar \ --connect jdbc:sybase:db \ --username user \ --password 'pwd' \ --driver com.sybase.jdbc3.jdbc.sybdriver \ --query "select  a.* table1 join table2 b on a.id=b.id a.run_group=b.run_group , convert(varchar, a.date, 101) < '7/22/2016' , \$conditions" \ --target-dir /user/user/a/ \ --verbose \ --hive-import \ --hive-table default.temp_a \ --split-by a.id 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -