You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "Gabriell-h (via GitHub)" <gi...@apache.org> on 2023/05/15 01:56:06 UTC

[GitHub] [incubator-seatunnel] Gabriell-h opened a new issue, #4748: Jdbc source中query的sql语句不支持函数

Gabriell-h opened a new issue, #4748:
URL: https://github.com/apache/incubator-seatunnel/issues/4748

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
   
   
   ### What happened
   
   JDBC source端里的query 中 sql语句不能识别函数比如我在greenplum里能select count(*) from da_metrics.td_metrics tm where w_upd_dt between now()-interval '1 year' and now()查找  但是在source中这样配置会报错  不能识别Now()函数
   
   ### SeaTunnel Version
   
   2.3.1
   
   ### SeaTunnel Config
   
   ```conf
   env {
     # You can set flink configuration here
     execution.parallelism = 1
     job.mode = "BATCH"
   }
   
   source {
     # This is a example source plugin **only for test and demonstrate the feature source plugin**
      Jdbc {
           url = "jdbc:postgresql://10.200.194.105:5234/CRLAND_DP"
           driver = "org.postgresql.Driver"
           user = "ur_uapp_crland_dp"
           password = ""
           query = "select * from da_metrics.td_metrics where w_upd_dt between now()-interval '1 year' and now()  "
       }
   
   }
   transform {
    }
   
   sink {
   StarRocks {
       nodeUrls = ["10.207.0.168:8030","10.207.0.174:8030","10.207.0.172:8030"]
       base-url = "jdbc:mysql://10.207.0.168:9030"
       username = "root"
       password = ""
       database = "odc"
       table = "td_metrics"
      batch_interval_ms = 10000
       max_retries = 10
   }
   }
   ```
   
   
   ### Running Command
   
   ```shell
   bin/flink run -t yarn-per-job -Dyarn.application.queue=flink -d -c org.apache.seatunnel.core.starter.flink.SeaTunnelFlink /app/seatunnel/starter/seatunnel-flink-13-starter-2.3.1.jar --config /app/seatunnel/config/gp2sr_sale_plan.conf --name SeaTunnel
   ```
   
   
   ### Error Exception
   
   ```log
   Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "now"
     Position: 52
   	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
   	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
   	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
   	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
   	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
   	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:190)
   	at org.postgresql.jdbc.PgPreparedStatement.executeQuery(PgPreparedStatement.java:134)
   	at org.apache.seatunnel.connectors.seatunnel.jdbc.internal.JdbcInputFormat.open(JdbcInputFormat.java:181)
   	... 6 more
   ```
   
   
   ### Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] Gabriell-h commented on issue #4748: Jdbc source中query的sql语句不支持函数

Posted by "Gabriell-h (via GitHub)" <gi...@apache.org>.
Gabriell-h commented on issue #4748:
URL: https://github.com/apache/incubator-seatunnel/issues/4748#issuecomment-1549239470

   fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] Gabriell-h closed issue #4748: Jdbc source中query的sql语句不支持函数

Posted by "Gabriell-h (via GitHub)" <gi...@apache.org>.
Gabriell-h closed issue #4748: Jdbc source中query的sql语句不支持函数
URL: https://github.com/apache/incubator-seatunnel/issues/4748


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] Gabriell-h commented on issue #4748: Jdbc source中query的sql语句不支持函数

Posted by "Gabriell-h (via GitHub)" <gi...@apache.org>.
Gabriell-h commented on issue #4748:
URL: https://github.com/apache/incubator-seatunnel/issues/4748#issuecomment-1549238482

   fix


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-seatunnel] zhilinli123 commented on issue #4748: Jdbc source中query的sql语句不支持函数

Posted by "zhilinli123 (via GitHub)" <gi...@apache.org>.
zhilinli123 commented on issue #4748:
URL: https://github.com/apache/incubator-seatunnel/issues/4748#issuecomment-1547114091

   ```
   env {
     execution.parallelism = 1
     job.mode = "BATCH"
   }
   
   source{
       jdbc{
           url = "jdbc:postgresql://localhost:5432/postgres"
           driver = "org.postgresql.Driver"
           user = "postgres"
           password = "12345678"
           query = " select * from public.tmp_function where  dt  between now()-interval '1 year' and now()"
       }
   }
   
   transform {
   }
   
   sink {
   Console{}
   }
   ```
   I had no problem just trying
   
   ```
          <dependency>
               <groupId>net.postgis</groupId>
               <artifactId>postgis-jdbc</artifactId>
               <version>2.5.1</version>
           </dependency>
   ```
   Make sure you have added the dependency package
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org