sqoop错误:where子句中的列“customernumber”不明确

qfe3c7zg  于 2021-06-03  发布在  Sqoop
关注(0)|答案(8)|浏览(349)

sqoop import --connect jdbc:mysql://localhost/classicmodels --username root --password cloudera --query ' select c.customernumber, c.customername, o.orderdate, o.ordernumber from customers AS c JOIN orders As o ON c.customernumber = o.customernumber WHERE $CONDITIONS ' --boundary-query 'select min(customernumber), max(customernumber) from customers ' --target-dir /data/info/customerdata/join --split-by customernumber ; mysql> describe customers ; +------------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------+------+-----+---------+-------+ | customerNumber | int(11) | NO | PRI | NULL | | | customerName | varchar(50) | NO | | NULL | | | contactLastName | varchar(50) | NO | | NULL | | | contactFirstName | varchar(50) | NO | | NULL | | | phone | varchar(50) | NO | | NULL | | | addressLine1 | varchar(50) | NO | | NULL | | | addressLine2 | varchar(50) | YES | | NULL | | | city | varchar(50) | NO | | NULL | | | state | varchar(50) | YES | | NULL | | | postalCode | varchar(15) | YES | | NULL | | | country | varchar(50) | NO | | NULL | | | salesRepEmployeeNumber | int(11) | YES | MUL | NULL | | | creditLimit | decimal(10,2) | YES | | NULL | | +------------------------+---------------+------+-----+---------+-------+ `mysql> describe orders ; +

lc8prwob

lc8prwob1#

sqoop import --connect jdbc:mysql://localhost/classicmodels --username root --password cloudera --query 'select customers.customernumber, customers.customername, orders.orderdate, orders.ordernumber FROM customers, orders WHERE customers.customernumber = orders.customernumber AND $CONDITIONS' --boundary-query 'select min(customernumber), max(customernumber) from customers' --target-dir /data/info/customerdata/join --split-by customers.customernumber ; 为了 --boundary-query ,确保customernumber应为数字列且不应为空。

6ovsh4lw

6ovsh4lw3#

在查询的where子句中尝试对sql使用tablename.column name语法。

js5cn81o

js5cn81o4#

---+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +

gpfsuwkq

gpfsuwkq6#

---+------+-----+---------+-------+ | orderNumber | int(11) | NO | PRI | NULL | | | orderDate | date | NO | | NULL | | | requiredDate | date | NO | | NULL | | | shippedDate | date | YES | | NULL | | | status | varchar(15) | NO | | NULL | | | comments | text | YES | | NULL | | | customerNumber | int(11) | NO | MUL | NULL | | +

siotufzp

siotufzp7#

---+------+-----+---------+-------+`

相关问题