简体   繁体   中英

How to add multiple filters in Sqoop --where clause?

My sample RDBMS data has below entries

+--------+-----------+----------+-----------+
| custid | fisrtname | lastname | city      |
+--------+-----------+----------+-----------+
|      1 | Arun      | Kumar    | chennai   |
|      2 | srini     | vasan    | chennai   |
|      3 | vasu      | devan    | bangalore |
|      4 | mohamed   | imran    | hydrabad  |
|      5 | arun      | basker   | chennai   |
+--------+-----------+----------+-----------+

I am trying to sqoop all entries where city is chennai or banglore using --where clause.

sqoop import --connect jdbc:mysql://localhost:3306/testdb --username root --password cloud --table customermod -m 1 --where "city='chennai,banglore'" --delete-target-dir --target-dir /user/cloud/citydata

What am I doing wrong?

You only need one filter, IN , not = . Assuming this is being appended into a SQL query, you want

city IN ('chennai' , 'bangalore')

None of your rows have a literal string 'chennai,banglore'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM