开发者社区> 问答> 正文

pyflink1.12 使用connector read.query参数报错怎么解决?

使用DDL 定义connector连接Mysql数据库,想通过发送sql的方式直接获取数据:  source_ddl = """  CREATE TABLE source_table(  yldrate DECIMAL,  pf_id VARCHAR,  symbol_id VARCHAR) WITH(  'connector' = 'jdbc',  'url' = 'jdbc:mysql://ip/db',  'driver' = 'com.mysql.cj.jdbc.Driver',  'username' = 'xxx',  'password' = 'xxx',  'table-name' = 'TS_PF_SEC_YLDRATE'  'read.query' = "SELECT YLDRATE, PF_ID, SYMBOL_ID FROM TS_PF_SEC_YLDRATE LEFT JOIN TP_GL_DAY ON DAY_ID = BIZ_DATE WHERE CCY_TYPE = 'AC' AND PF_ID = '1030100122' AND SYMBOL_ID = '2030004042' AND BIZ_DATE between '20160701' AND '20170307'"  )  """  报错信息:  File "C:\Users\18242\AppData\Local\Programs\Python\Python37\lib\site-packages\pyflink\table\table_environment.py", line 766, in execute_sql  return TableResult(self._j_tenv.executeSql(stmt))  File "C:\Users\18242\AppData\Local\Programs\Python\Python37\lib\site-packages\py4j\java_gateway.py", line 1286, in call  answer, self.gateway_client, self.target_id, self.name)  File "C:\Users\18242\AppData\Local\Programs\Python\Python37\lib\site-packages\pyflink\util\exceptions.py", line 147, in deco  return f(*a, **kw)  File "C:\Users\18242\AppData\Local\Programs\Python\Python37\lib\site-packages\py4j\protocol.py", line 328, in get_return_value  format(target_id, ".", name), value)  py4j.protocol.Py4JJavaError: An error occurred while calling o6.executeSql.  : org.apache.flink.table.api.SqlParserException: SQL parse failed. Encountered "=" at line 12, column 30.  Was expecting one of:  "UESCAPE" ...  <QUOTED_STRING> ...  ")" ...  "," ... 

提示期待的语法信息,没有看懂,为什么不能出现“=” ?希望路过的大佬,能够指导一下~~谢谢!*来自志愿者整理的flink邮件归档

展开
收起
CCCC 2021-12-02 14:45:07 789 0
1 条回答
写回答
取消 提交回答
  • 'table-name' = 'TS_PF_SEC_YLDRATE' 这一行后面少个逗号*来自志愿者整理的FLINK邮件归档

    2021-12-02 16:06:03
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Apache Phoenix and HBase: Past, Present and Future of SQL over HBase 立即下载
Apache Kudu & Apache Spark SQL for Fast Analytics on Fast Data 立即下载
Spark SQL:Past Present &Future 立即下载