Class Query

java.lang.Object
io.kestra.core.models.tasks.Task
io.kestra.plugin.jdbc.AbstractJdbcQuery
io.kestra.plugin.jdbc.mysql.Query
All Implemented Interfaces:
io.kestra.core.models.tasks.RunnableTask<io.kestra.plugin.jdbc.AbstractJdbcQuery.Output>, io.kestra.plugin.jdbc.AutoCommitInterface, io.kestra.plugin.jdbc.JdbcConnectionInterface, io.kestra.plugin.jdbc.JdbcQueryInterface, io.kestra.plugin.jdbc.JdbcStatementInterface

@Example(title="Send a SQL query to a MySQL Database and fetch a row as output.",code={"url: jdbc:mysql://127.0.0.1:3306/","username: mysql_user","password: mysql_passwd","sql: select * from mysql_types","fetchOne: true"}) @Example(title="Load a csv file into a MySQL table.",code={"url: jdbc:mysql://127.0.0.1:3306/","username: mysql_user","password: mysql_passwd","inputFile: \"{{ outputs.taskId.file }}\"","sql: |"," LOAD DATA LOCAL INFILE \'{{ inputFile }}\'"," INTO TABLE discounts FIELDS TERMINATED BY \',\'"," ENCLOSED BY \'\"\'"," LINES TERMINATED BY \'\\n\'"," IGNORE 1 ROWS;"}) public class Query extends io.kestra.plugin.jdbc.AbstractJdbcQuery implements io.kestra.core.models.tasks.RunnableTask<io.kestra.plugin.jdbc.AbstractJdbcQuery.Output>, io.kestra.plugin.jdbc.AutoCommitInterface
  • 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.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 final Boolean
     
    protected String
     
    protected Path
     

    Fields inherited from class io.kestra.plugin.jdbc.AbstractJdbcQuery

    additionalVars, fetchSize

    Fields inherited from class io.kestra.core.models.tasks.Task

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    connectionProperties(io.kestra.core.runners.RunContext runContext)
     
    protected io.kestra.plugin.jdbc.AbstractCellConverter
     
     
    void
     
    io.kestra.plugin.jdbc.AbstractJdbcQuery.Output
    run(io.kestra.core.runners.RunContext runContext)
     

    Methods inherited from class io.kestra.plugin.jdbc.AbstractJdbcQuery

    canEqual, createStatement, equals, fetchResult, fetchResults, fetchToFile, getPassword, getSql, getTimeZoneId, getUrl, getUsername, hashCode, isFetch, isFetchOne, isStore, toString

    Methods inherited from class io.kestra.core.models.tasks.Task

    findById, findById, getDescription, getDisabled, getId, getLogLevel, getRetry, getTimeout, getType, getWorkerGroup, isAllowFailure, isFlowable, isSendToWorkerTask

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.kestra.plugin.jdbc.AutoCommitInterface

    getAutoCommit

    Methods inherited from interface io.kestra.plugin.jdbc.JdbcConnectionInterface

    connection

    Methods inherited from interface io.kestra.plugin.jdbc.JdbcStatementInterface

    zoneId
  • Field Details

    • autoCommit

      protected final Boolean autoCommit
    • inputFile

      @PluginProperty(dynamic=true) protected String inputFile
    • workingDirectory

      protected transient Path workingDirectory
  • Constructor Details

    • Query

      public Query()
  • Method Details

    • getCellConverter

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

      public void registerDriver() throws SQLException
      Specified by:
      registerDriver in interface io.kestra.plugin.jdbc.JdbcConnectionInterface
      Throws:
      SQLException
    • connectionProperties

      public Properties connectionProperties(io.kestra.core.runners.RunContext runContext) throws Exception
      Specified by:
      connectionProperties in interface io.kestra.plugin.jdbc.JdbcConnectionInterface
      Throws:
      Exception
    • getFetchSize

      public Integer getFetchSize()
      Specified by:
      getFetchSize in interface io.kestra.plugin.jdbc.JdbcQueryInterface
      Overrides:
      getFetchSize in class io.kestra.plugin.jdbc.AbstractJdbcQuery
    • run

      public io.kestra.plugin.jdbc.AbstractJdbcQuery.Output run(io.kestra.core.runners.RunContext runContext) throws 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:
      Exception