简体   繁体   English

如何在 Sqoop --where 子句中添加多个过滤器?

[英]How to add multiple filters in Sqoop --where clause?

My sample RDBMS data has below entries我的示例 RDBMS 数据具有以下条目

+--------+-----------+----------+-----------+
| 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.我正在尝试使用--where子句对城市为 chennai 或 banglore 的所有条目进行 sqoop。

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 = .您只需要一个过滤器IN ,而不是= Assuming this is being appended into a SQL query, you want假设这被附加到 SQL 查询中,你想要

city IN ('chennai' , 'bangalore')

None of your rows have a literal string 'chennai,banglore'您的所有行都没有文字字符串'chennai,banglore'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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