Skip to content

Commit

Permalink
fix(docs): add full examples for multiple jdbc tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutimantri committed Sep 5, 2024
1 parent 674cd38 commit b1fe399
Show file tree
Hide file tree
Showing 28 changed files with 726 additions and 584 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,37 @@
examples = {
@Example(
title = "Send a SQL query to a database and fetch row(s) using Apache Arrow Flight SQL driver.",
code = {
"url: jdbc:arrow-flight-sql://localhost:31010/?useEncryption=false",
"username: db_user",
"password: db_passwd",
"sql: select * FROM departments",
"fetch: true",
}
full = true,
code = """
id: arrow_flight_sql_query
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.arrowflight.Query
url: jdbc:arrow-flight-sql://localhost:31010/?useEncryption=false
username: db_user
password: db_password
sql: select * FROM departments
fetch: true
"""
),
@Example(
title = "Send a SQL query to a Dremio coordinator and fetch rows as output using Apache Arrow Flight SQL driver.",
code = {
"url: jdbc:arrow-flight-sql://dremio-coordinator:32010/?schema=postgres.public",
"username: dremio_user",
"password: dremio_passwd",
"sql: select * FROM departments",
"fetch: true",
}
full = true,
code = """
id: arrow_flight_sql_query
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.arrowflight.Query
url: jdbc:arrow-flight-sql://dremio-coordinator:32010/?schema=postgres.public
username: dremio_user
password: dremio_password
sql: select * FROM departments
fetch: true
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,29 @@
@Example(
title = "Wait for a SQL query to return results, and then iterate through rows.",
full = true,
code = {
"id: jdbc_trigger",
"namespace: company.team",
"",
"tasks:",
" - id: each",
" type: io.kestra.plugin.core.flow.EachSequential",
" tasks:",
" - id: return",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ json(taskrun.value) }}\"",
" value: \"{{ trigger.rows }}\"",
"",
"triggers:",
" - id: watch",
" type: io.kestra.plugin.jdbc.arrowflight.Trigger",
" username: dremio_user",
" password: dremio_passwd",
" url: jdbc:arrow-flight-sql://dremio-coordinator:32010/?schema=postgres.public",
" interval: \"PT5M\"",
" sql: \"SELECT * FROM my_table\"",
" fetch: true",
}
code = """
id: jdbc_trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.EachSequential
tasks:
- id: return
type: io.kestra.plugin.core.debug.Return
format: "{{ json(taskrun.value) }}"
value: "{{ trigger.rows }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.arrowflight.Trigger
username: dremio_user
password: dremio_password
url: jdbc:arrow-flight-sql://dremio-coordinator:32010/?schema=postgres.public
interval: "PT5M"
sql: "SELECT * FROM my_table"
fetch: true
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@
examples = {
@Example(
title = "Send a SQL query to a AS400 Database and fetch a row as output.",
code = {
"url: jdbc:as400://127.0.0.1:50000/",
"username: as400_user",
"password: as400_passwd",
"sql: select * from as400_types",
"fetchOne: true",
}
full = true,
code = """
id: as400_query
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.as400.Query
url: jdbc:as400://127.0.0.1:50000/
username: as400_user
password: as400_password
sql: select * from as400_types
fetchOne: true
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@
@Example(
title = "Wait for a SQL query to return results, and then iterate through rows.",
full = true,
code = {
"id: jdbc_trigger",
"namespace: company.team",
"",
"tasks:",
" - id: each",
" type: io.kestra.plugin.core.flow.EachSequential",
" tasks:",
" - id: return",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ json(taskrun.value) }}\"",
" value: \"{{ trigger.rows }}\"",
"",
"triggers:",
" - id: watch",
" type: io.kestra.plugin.jdbc.as400.Trigger",
" interval: \"PT5M\"",
" url: jdbc:as400://127.0.0.1:50000/",
" username: as400_user",
" password: as400_passwd",
" sql: \"SELECT * FROM my_table\"",
" fetch: true",
}
code = """
id: jdbc_trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.EachSequential
tasks:
- id: return
type: io.kestra.plugin.core.debug.Return
format: "{{ json(taskrun.value) }}"
value: "{{ trigger.rows }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.as400.Trigger
interval: "PT5M"
url: jdbc:as400://127.0.0.1:50000/
username: as400_user
password: as400_password
sql: "SELECT * FROM my_table"
fetch: true
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,54 @@
examples = {
@Example(
title = "Insert rows from another table to a Clickhouse database using asynchronous inserts.",
code = {
"from: \"{{ outputs.query.uri }}\"",
"url: jdbc:clickhouse://127.0.0.1:56982/",
"username: ch_user",
"password: ch_passwd",
"sql: INSERT INTO YourTable SETTINGS async_insert=1, wait_for_async_insert=1 values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )"
}
full = true,
code = """
id: clickhouse_bulk_insert
namespace: company.team
tasks:
- id: bulk_insert
type: io.kestra.plugin.jdbc.clickhouse.BulkInsert
from: "{{ outputs.query.uri }}"
url: jdbc:clickhouse://127.0.0.1:56982/
username: ch_user
password: ch_password
sql: INSERT INTO YourTable SETTINGS async_insert=1, wait_for_async_insert=1 values( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
"""
),
@Example(
title = "Insert data into specific columns via a SQL query to a ClickHouse database using asynchronous inserts.",
code = {
"from: \"{{ outputs.query.uri }}\"",
"url: jdbc:clickhouse://127.0.0.1:56982/",
"username: ch_user",
"password: ch_passwd",
"sql: INSERT INTO YourTable ( field1, field2, field3 ) SETTINGS async_insert=1, wait_for_async_insert=1 values( ?, ?, ? )"
}
full = true,
code = """
id: clickhouse_bulk_insert
namespace: company.team
tasks:
- id: bulk_insert
type: io.kestra.plugin.jdbc.clickhouse.BulkInsert
from: "{{ outputs.query.uri }}"
url: jdbc:clickhouse://127.0.0.1:56982/
username: ch_user
password: ch_password
sql: INSERT INTO YourTable ( field1, field2, field3 ) SETTINGS async_insert=1, wait_for_async_insert=1 values( ?, ?, ? )
"""
),
@Example(
title = "Insert data into specific columns via a SQL query to a ClickHouse database using asynchronous inserts.",
code = {
"from: \"{{ outputs.query.uri }}\"",
"url: jdbc:clickhouse://127.0.0.1:56982/",
"username: ch_user",
"password: ch_passwd",
"table: YourTable"
}
full = true,
code = """
id: clickhouse_bulk_insert
namespace: company.team
tasks:
- id: bulk_insert
type: io.kestra.plugin.jdbc.clickhouse.BulkInsert
from: "{{ outputs.query.uri }}"
url: jdbc:clickhouse://127.0.0.1:56982/
username: ch_user
password: ch_password
table: YourTable
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@
examples = {
@Example(
title = "Query a Clickhouse database.",
code = {
"url: jdbc:clickhouse://127.0.0.1:56982/",
"username: ch_user",
"password: ch_passwd",
"sql: select * from clickhouse_types",
"store: true",
}
full = true,
code = """
id: clickhouse_query
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.clickhouse.Query
url: jdbc:clickhouse://127.0.0.1:56982/
username: ch_user
password: ch_password
sql: select * from clickhouse_types
store: true
"""
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,29 @@
@Example(
title = "Wait for a SQL query to return results, and then iterate through rows.",
full = true,
code = {
"id: jdbc_trigger",
"namespace: company.team",
"",
"tasks:",
" - id: each",
" type: io.kestra.plugin.core.flow.EachSequential",
" tasks:",
" - id: return",
" type: io.kestra.plugin.core.debug.Return",
" format: \"{{ json(taskrun.value) }}\"",
" value: \"{{ trigger.rows }}\"",
"",
"triggers:",
" - id: watch",
" type: io.kestra.plugin.jdbc.clickhouse.Trigger",
" interval: \"PT5M\"",
" url: jdbc:clickhouse://127.0.0.1:56982/",
" username: ch_user",
" password: ch_passwd",
" sql: \"SELECT * FROM my_table\"",
" fetch: true",
}
code = """
id: jdbc_trigger
namespace: company.team
tasks:
- id: each
type: io.kestra.plugin.core.flow.EachSequential
tasks:
- id: return
type: io.kestra.plugin.core.debug.Return
format: "{{ json(taskrun.value) }}"
value: "{{ trigger.rows }}"
triggers:
- id: watch
type: io.kestra.plugin.jdbc.clickhouse.Trigger
interval: "PT5M"
url: jdbc:clickhouse://127.0.0.1:56982/
username: ch_user
password: ch_password
sql: "SELECT * FROM my_table"
fetch: true
"""
)
}
)
Expand Down
21 changes: 14 additions & 7 deletions plugin-jdbc-db2/src/main/java/io/kestra/plugin/jdbc/db2/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,20 @@
examples = {
@Example(
title = "Send a SQL query to a DB2 Database and fetch a row as output.",
code = {
"url: jdbc:db2://127.0.0.1:50000/",
"username: db2inst",
"password: db2_passwd",
"sql: select * from db2_types",
"fetchOne: true",
}
full = true,
code = """
id: db2_query
namespace: company.team
tasks:
- id: query
type: io.kestra.plugin.jdbc.db2.Query
url: jdbc:db2://127.0.0.1:50000/
username: db2inst
password: db2_password
sql: select * from db2_types
fetchOne: true
"""
)
}
)
Expand Down
Loading

0 comments on commit b1fe399

Please sign in to comment.