带日期的sqoop psql查询

2vuwiymt  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(392)

嗨,我对swoop和psaldb有疑问

Sqoop import --connect 'jdbc:postgresql://xx.xx.xxx.xx:xxxxx/database' --query 'select * from report where transact_time = '20160603-00:00:01' and $CONDITIONS' --username uname --target-dir /user/x/data --split-by transact_time

我得到以下错误:

Error executing statement: org.postgresql.util.PSQLException: ERROR: syntax error at or near ":"
  Position: 61
  org.postgresql.util.PSQLException: ERROR: syntax error at or near ":"
zlhcx6iw

zlhcx6iw1#

您需要发出用双引号括起来的查询( " )因为你用的是单引号( ' )在查询中,您必须使用 \$CONDITIONS 而不仅仅是 $CONDITIONS 禁止shell将其视为shell变量。
尝试:

--query "select * from report where transact_time = '20160603-00:00:01' and \$CONDITIONS"

相关问题