io.kestra.plugin.jdbc.dremio.Query Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plugin-jdbc-dremio Show documentation
Show all versions of plugin-jdbc-dremio Show documentation
Query Dremio database using the Kestra JDBC plugin.
package io.kestra.plugin.jdbc.dremio;
import io.kestra.core.models.annotations.Example;
import io.kestra.core.models.annotations.Plugin;
import io.kestra.core.models.tasks.RunnableTask;
import io.kestra.core.runners.RunContext;
import io.kestra.plugin.jdbc.AbstractCellConverter;
import io.kestra.plugin.jdbc.AbstractJdbcQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.time.ZoneId;
@SuperBuilder
@ToString
@EqualsAndHashCode
@Getter
@NoArgsConstructor
@Schema(
title = "Query a Dremio database."
)
@Plugin(
examples = {
@Example(
title = "Send a SQL query to a Dremio database and fetch a row as output.",
code = {
"url: jdbc:dremio:direct=sql.dremio.cloud:443;ssl=true;PROJECT_ID=sampleProjectId;",
"username: $token",
"password: samplePersonalAccessToken",
"sql: select * FROM source.database.table",
"fetchOne: true",
}
)
}
)
public class Query extends AbstractJdbcQuery implements RunnableTask {
@Override
protected AbstractCellConverter getCellConverter(ZoneId zoneId) {
return new DremioCellConverter(zoneId);
}
@Override
public void registerDriver() throws SQLException {
DriverManager.registerDriver(new com.dremio.jdbc.Driver());
}
@Override
public Output run(RunContext runContext) throws Exception {
return super.run(runContext);
}
}