Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
iNikitaGricenko authored Oct 18, 2023
2 parents 0d9ad21 + 582e472 commit e0bb592
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 28 deletions.
37 changes: 37 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!-- Thanks for submitting a Pull Request to kestra. To help us review your contribution, please follow the guidelines below:
- Make sure that your commits follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) specification e.g. `feat(ui): add a new navigation menu item` or `fix(core): fix a bug in the core model` or `docs: update the README.md`. This will help us automatically generate the changelog.
- The title should briefly summarize the proposed changes.
- Provide a short overview of the change and the value it adds.
- Share a flow example to help the reviewer understand and QA the change.
- Use "close" to automatically close an issue. For example, `close #1234` will close issue #1234. -->

### What changes are being made and why?
<!-- Please include a brief summary of the changes included in this PR e.g. closes #1234. -->

---

### How the changes have been QAed?

<!-- Include example code that shows how this PR has been QAed. The code should present a complete yet easily reproducible flow.
```yaml
# Your example flow code here
```
Note that this is not a replacement for unit tests but rather a way to demonstrate how the changes work in a real-life scenario, as the end-user would experience them.
Remove this section if this change applies to all flows or to the documentation only. -->

---

### Setup Instructions

<!--If there are any setup requirements like API keys or trial accounts, kindly include brief bullet-points-description outlining the setup process below.
- [External System Documentation](URL)
- Steps to set up the necessary resources
If there are no setup requirements, you can remove this section.
Thank you for your contribution. ❤️ -->
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,49 @@
# Kestra JDBC Plugin
<p align="center">
<a href="https://www.kestra.io">
<img src="https://kestra.io/banner.png" alt="Kestra workflow orchestrator" />
</a>
</p>

<h1 align="center" style="border-bottom: none">
Event-Driven Declarative Orchestrator
</h1>

<div align="center">
<a href="https://github.com/kestra-io/kestra/releases"><img src="https://img.shields.io/github/tag-pre/kestra-io/kestra.svg?color=blueviolet" alt="Last Version" /></a>
<a href="https://github.com/kestra-io/kestra/blob/develop/LICENSE"><img src="https://img.shields.io/github/license/kestra-io/kestra?color=blueviolet" alt="License" /></a>
<a href="https://github.com/kestra-io/kestra/stargazers"><img src="https://img.shields.io/github/stars/kestra-io/kestra?color=blueviolet&logo=github" alt="Github star" /></a> <br>
<a href="https://kestra.io"><img src="https://img.shields.io/badge/Website-kestra.io-192A4E?color=blueviolet" alt="Kestra infinitely scalable orchestration and scheduling platform"></a>
<a href="https://kestra.io/slack"><img src="https://img.shields.io/badge/Slack-Join%20Community-blueviolet?logo=slack" alt="Slack"></a>
</div>

<br />

<p align="center">
<a href="https://twitter.com/kestra_io"><img height="25" src="https://kestra.io/twitter.svg" alt="twitter" /></a> &nbsp;
<a href="https://www.linkedin.com/company/kestra/"><img height="25" src="https://kestra.io/linkedin.svg" alt="linkedin" /></a> &nbsp;
<a href="https://www.youtube.com/@kestra-io"><img height="25" src="https://kestra.io/youtube.svg" alt="youtube" /></a> &nbsp;
</p>

<br />
<p align="center">
<img width="460" src="https://kestra.io/logo.svg" alt="Kestra workflow orchestrator" />
<a href="https://www.youtube.com/watch?v=h-P0eK2xN58&ab_channel=Kestra" target="_blank">
<img src="https://kestra.io/startvideo.png" alt="Get started in 4 minutes with Kestra" width="640px" />
</a>
</p>
<p align="center" style="color:grey;"><i>Get started with Kestra in 4 minutes.</i></p>

# Kestra JDBC Plugin

> Plugin to interact with SQL Databases via JDBC
![Kestra orchestrator](https://kestra.io/ui.gif)

![Kestra orchestrator](https://kestra.io/video.gif)


## Documentation
* The official Kestra documentation can be found under: [kestra.io](https://kestra.io)
* This plugin documentation is available here :
* Full documentation can be found under [kestra.io/docs](https://kestra.io/docs)
* Documentation for developing a plugin is included in the [Plugin Developer Guide](https://kestra.io/docs/plugin-developer-guide/)
* The documentation for specific sub-plugins:
* [for ClickHouse](https://kestra.io/plugins/plugin-jdbc-clickhouse/)
* [for DuckDb](https://kestra.io/plugins/plugin-jdbc-duckdb/)
* [for MySQL](https://kestra.io/plugins/plugin-jdbc-mysql/)
Expand All @@ -25,7 +57,15 @@
* [for Trino](https://kestra.io/plugins/plugin-jdbc-trino/)
* [for Vectorwise](https://kestra.io/plugins/plugin-jdbc-vectorwise/)
* [for Vertica](https://kestra.io/plugins/plugin-jdbc-vertica/)

* ...and more!


## License
Apache 2.0 © [Kestra Technologies](https://kestra.io)


## Stay up to date

We release new versions every month. Give the [main repository](https://github.com/kestra-io/kestra) a star to stay up to date with the latest releases and get notified about future updates.

![Star the repo](https://kestra.io/star.gif)
2 changes: 1 addition & 1 deletion plugin-jdbc-duckdb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jar {
}

dependencies {
implementation("org.duckdb:duckdb_jdbc:0.9.0")
implementation("org.duckdb:duckdb_jdbc:0.8.1")
implementation project(':plugin-jdbc')

testImplementation project(':plugin-jdbc').sourceSets.test.output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void select() throws Exception {
@Test
void inputOutputFiles() throws Exception {
URI source = storageInterface.put(
null,
new URI("/" + IdUtils.create()),
new FileInputStream(new File(Objects.requireNonNull(DuckDbTest.class.getClassLoader()
.getResource("full.csv"))
Expand All @@ -199,7 +200,7 @@ void inputOutputFiles() throws Exception {
System.out.println(JacksonMapper.ofYaml().writeValueAsString(task));

assertThat(
IOUtils.toString(storageInterface.get(runOutput.getOutputFiles().get("out")), Charsets.UTF_8),
IOUtils.toString(storageInterface.get(null, runOutput.getOutputFiles().get("out")), Charsets.UTF_8),
is( "id,name\n" +
"4814976,Viva\n" +
"1010871,Voomm\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ void load() throws Exception {
URL resource = LoadTest.class.getClassLoader().getResource("load.csv");

URI put = storageInterface.put(
null,
new URI("/file/storage/get.yml"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -91,7 +91,7 @@ public void namedInsert() throws Exception {

}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -122,7 +122,7 @@ public void namedColumnsInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

ArrayList<String> columns = new ArrayList<>();
columns.add("t_id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
@Getter
@NoArgsConstructor
@Schema(
title = "Copy from a file to PostgreSQL table"
title = "Copy tabular data from a Postgres table to a file"
)
@Plugin(
examples = {
@Example(
title = "Export a csv or tsv from a postgres table or query",
title = "Export a Postgres table or query to a CSV or TSV file",
code = {
"url: jdbc:postgresql://127.0.0.1:56982/",
"username: postgres",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -154,7 +154,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(TestUtils.url())
Expand Down Expand Up @@ -191,7 +191,7 @@ public void namedColumnsInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(TestUtils.url())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void selectAndFetchToFile() throws Exception {
AbstractJdbcQuery.Output runOutput = task.run(runContext);
assertThat(runOutput.getUri(), notNullValue());

BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(runOutput.getUri())));
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(this.storageInterface.get(null, runOutput.getUri())));
int lines = 0;
while (bufferedReader.readLine() != null) {
lines++;
Expand Down Expand Up @@ -208,6 +208,7 @@ void selectWithCompositeType() throws Exception {
@Test
void updateFromFlow() throws Exception {
Execution execution = runnerUtils.runOne(
null,
"io.kestra.jdbc.postgres",
"update_postgres",
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void success() throws Exception {
URL resource = UploadDownloadTest.class.getClassLoader().getResource("scripts/snowflake.sql");

URI put = storageInterface.put(
null,
new URI("/file/storage/snowflake.sql"),
new FileInputStream(Objects.requireNonNull(resource).getFile())
);
Expand Down Expand Up @@ -82,8 +83,8 @@ void success() throws Exception {
assertThat(downloadRun.getUri(), notNullValue());

assertThat(
IOUtils.toString(this.storageInterface.get(downloadRun.getUri()), Charsets.UTF_8),
is(IOUtils.toString(this.storageInterface.get(put), Charsets.UTF_8))
IOUtils.toString(this.storageInterface.get(null, downloadRun.getUri()), Charsets.UTF_8),
is(IOUtils.toString(this.storageInterface.get(null, put), Charsets.UTF_8))
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void insert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -94,7 +94,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -125,7 +125,7 @@ public void namedColumnsInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

ArrayList<String> columns = new ArrayList<>();
columns.add("t_id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -123,7 +123,7 @@ public void namedInsert() throws Exception {
}


URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -174,7 +174,7 @@ public void namedColumnsInsert() throws Exception {

}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void insert() throws Exception {
));
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -103,7 +103,7 @@ public void namedInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down Expand Up @@ -134,7 +134,7 @@ public void namedColumnsInsert() throws Exception {
);
}

URI uri = storageInterface.put(URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));
URI uri = storageInterface.put(null, URI.create("/" + IdUtils.create() + ".ion"), new FileInputStream(tempFile));

Batch task = Batch.builder()
.url(getUrl())
Expand Down

0 comments on commit e0bb592

Please sign in to comment.