Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter binding to the Query tasks and Trigger triggers #376

Open
3 tasks
anna-geller opened this issue Sep 3, 2024 · 2 comments
Open
3 tasks

Add parameter binding to the Query tasks and Trigger triggers #376

anna-geller opened this issue Sep 3, 2024 · 2 comments
Assignees
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request good first issue Great issue for new contributors kind/highlight One of the highlights of the upcoming release

Comments

@anna-geller
Copy link
Member

anna-geller commented Sep 3, 2024

We want to support parameter binding in SQL Query tasks. This is an optional property, so it is not a breaking change.

  • parameters:
    • Typemap
    • Required: ❌
    • Description: A map of parameters to bind to the SQL queries. The keys should match the parameter placeholders in the SQL string, e.g., :parameterName.

Example flow:

id: run_query
namespace: company.team

tasks:
  - id: query
    type: io.kestra.plugin.jdbc.postgresql.Query
    url: jdbc:postgresql://host.docker.internal:5432/postgres
    username: postgres
    password: xxx
    sql: |
      INSERT INTO myusers (name, email, login) 
      VALUES (:name, :email, :login) 
      ON CONFLICT (email) DO NOTHING;
    parameters:
      name: Rick
      email: "[email protected]"
      login: "{{ execution.startDate }}"

Similar parameters map will be needed on the Trigger https://kestra.io/plugins/plugin-jdbc-postgres/triggers/io.kestra.plugin.jdbc.postgresql.trigger

TODOs:

  • start by adding this in Postgres
  • adjust all JDBC Query tasks
  • adjust all JDBC Trigger triggers
@anna-geller anna-geller added enhancement New feature or request area/plugin Plugin-related issue or feature request labels Sep 3, 2024
@kestrabot kestrabot bot added this to Issues Sep 3, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Sep 3, 2024
@Ben8t
Copy link
Member

Ben8t commented Sep 3, 2024

Advantage vs Pebble ?

-> less verbose (because one would have to use a "long" outputs.task.some_value or inputs.value)
-> 🤔 ?

INSERT INTO myusers (name, email, login) 
VALUES ({{inputs.name}}, {{inputs.email}}, {{inputs.login}}) 
ON CONFLICT ({{inputs.email}}) DO NOTHING

@loicmathieu
Copy link
Member

Advantage vs Pebble ?

Avoid SQL injection!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request enhancement New feature or request good first issue Great issue for new contributors kind/highlight One of the highlights of the upcoming release
Projects
Status: Backlog
Development

No branches or pull requests

4 participants