Class Query

  • All Implemented Interfaces:
    io.kestra.core.models.tasks.RunnableTask<io.kestra.plugin.jdbc.AbstractJdbcQuery.Output>, PostgresConnectionInterface

    @Plugin(examples=@Example(full=true,title="Execute a query and fetch results on another task to update another table",code={"tasks:","- id: update","  type: io.kestra.plugin.jdbc.postgresql.Query","  url: jdbc:postgresql://127.0.0.1:56982/","  username: postgres","  password: pg_passwd","  sql: select concert_id, available, a, b, c, d, play_time, library_record, floatn_test, double_test, real_test, numeric_test, date_type, time_type, timez_type, timestamp_type, timestampz_type, interval_type, pay_by_quarter, schedule, json_type, blob_type from pgsql_types","  fetch: true","- id: use-fetched-data","  type: io.kestra.plugin.jdbc.postgresql.Query","  url: jdbc:postgresql://127.0.0.1:56982/","  username: postgres","  password: pg_passwd","  sql:  \"{{#each outputs.update.rows}} INSERT INTO pl_store_distribute (year_month,store_code, update_date) values ({{this.play_time}}, {{this.concert_id}}, TO_TIMESTAMP(\'{{this.timestamp_type}}\', \'YYYY/MM/DDTHH24:MI:SS.US\') ); {{/each}}\""}))
    public class Query
    extends io.kestra.plugin.jdbc.AbstractJdbcQuery
    implements io.kestra.core.models.tasks.RunnableTask<io.kestra.plugin.jdbc.AbstractJdbcQuery.Output>, PostgresConnectionInterface
    • Nested Class Summary

      • Nested classes/interfaces inherited from class io.kestra.plugin.jdbc.AbstractJdbcQuery

        io.kestra.plugin.jdbc.AbstractJdbcQuery.AbstractJdbcQueryBuilder<C extends io.kestra.plugin.jdbc.AbstractJdbcQuery,​B extends io.kestra.plugin.jdbc.AbstractJdbcQuery.AbstractJdbcQueryBuilder<C,​B>>, io.kestra.plugin.jdbc.AbstractJdbcQuery.Output
      • Nested classes/interfaces inherited from class io.kestra.plugin.jdbc.AbstractJdbcConnection

        io.kestra.plugin.jdbc.AbstractJdbcConnection.AbstractJdbcConnectionBuilder<C extends io.kestra.plugin.jdbc.AbstractJdbcConnection,​B extends io.kestra.plugin.jdbc.AbstractJdbcConnection.AbstractJdbcConnectionBuilder<C,​B>>
      • Nested classes/interfaces inherited from class io.kestra.core.models.tasks.Task

        io.kestra.core.models.tasks.Task.TaskBuilder<C extends io.kestra.core.models.tasks.Task,​B extends io.kestra.core.models.tasks.Task.TaskBuilder<C,​B>>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Boolean ssl  
      protected java.lang.String sslCert  
      protected java.lang.String sslKey  
      protected java.lang.String sslKeyPassword  
      protected PostgresConnectionInterface.SslMode sslMode  
      protected java.lang.String sslRootCert  
      • Fields inherited from class io.kestra.plugin.jdbc.AbstractJdbcConnection

        autoCommit, password, url, username
      • Fields inherited from class io.kestra.core.models.tasks.Task

        disabled, id, retry, timeout, type
    • Constructor Summary

      Constructors 
      Constructor Description
      Query()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.Properties connectionProperties​(io.kestra.core.runners.RunContext runContext)  
      protected io.kestra.plugin.jdbc.AbstractCellConverter getCellConverter​(java.time.ZoneId zoneId)  
      protected void registerDriver()  
      io.kestra.plugin.jdbc.AbstractJdbcQuery.Output run​(io.kestra.core.runners.RunContext runContext)  
      • Methods inherited from class io.kestra.plugin.jdbc.AbstractJdbcQuery

        canEqual, equals, fetchResult, fetchResults, fetchToFile, getFetch, getFetchOne, getFetchSize, getSql, getStore, getTimeZoneId, hashCode, toString
      • Methods inherited from class io.kestra.plugin.jdbc.AbstractJdbcConnection

        cleanup, connection, getAutoCommit, getPassword, getUrl, getUsername, tempFile, tempFile
      • Methods inherited from class io.kestra.core.models.tasks.Task

        findById, findById, getDescription, getDisabled, getId, getRetry, getTimeout, getType, isFlowable
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • ssl

        protected java.lang.Boolean ssl
      • sslRootCert

        protected java.lang.String sslRootCert
      • sslCert

        protected java.lang.String sslCert
      • sslKey

        protected java.lang.String sslKey
      • sslKeyPassword

        protected java.lang.String sslKeyPassword
    • Constructor Detail

      • Query

        public Query()
    • Method Detail

      • connectionProperties

        protected java.util.Properties connectionProperties​(io.kestra.core.runners.RunContext runContext)
                                                     throws io.kestra.core.exceptions.IllegalVariableEvaluationException,
                                                            java.io.IOException
        Overrides:
        connectionProperties in class io.kestra.plugin.jdbc.AbstractJdbcConnection
        Throws:
        io.kestra.core.exceptions.IllegalVariableEvaluationException
        java.io.IOException
      • getCellConverter

        protected io.kestra.plugin.jdbc.AbstractCellConverter getCellConverter​(java.time.ZoneId zoneId)
        Specified by:
        getCellConverter in class io.kestra.plugin.jdbc.AbstractJdbcQuery
      • registerDriver

        protected void registerDriver()
                               throws java.sql.SQLException
        Specified by:
        registerDriver in class io.kestra.plugin.jdbc.AbstractJdbcConnection
        Throws:
        java.sql.SQLException
      • run

        public io.kestra.plugin.jdbc.AbstractJdbcQuery.Output run​(io.kestra.core.runners.RunContext runContext)
                                                           throws java.lang.Exception
        Specified by:
        run in interface io.kestra.core.models.tasks.RunnableTask<io.kestra.plugin.jdbc.AbstractJdbcQuery.Output>
        Overrides:
        run in class io.kestra.plugin.jdbc.AbstractJdbcQuery
        Throws:
        java.lang.Exception