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

Duckdb dynamic database #448

Open
Vinceveve opened this issue Dec 2, 2024 · 5 comments
Open

Duckdb dynamic database #448

Vinceveve opened this issue Dec 2, 2024 · 5 comments
Assignees
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working

Comments

@Vinceveve
Copy link

Describe the issue

I have an issue with duckdb if i use the sample from the doc I get and error >io.kestra.plugin.jdbc.duckdb.Query["databaseFile"]: Unrecognized field "databaseFile"

If I use a variable (or input) on the url, I get The database file path is not valid (Path to database file must be absolute)

Example task :

variables: 
  db: /temp/occ/rodez/set_parent_station.db
tasks: 
  - id: create_stop_table
    type: io.kestra.plugin.jdbc.duckdb.Query
    url: "jdbc:duckdb:{{ vars.db }}"

image

Environment

  • Kestra Version: 0.19.10
@Vinceveve Vinceveve added area/plugin Plugin-related issue or feature request bug Something isn't working labels Dec 2, 2024
@kestrabot kestrabot bot added this to Issues Dec 2, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Issues Dec 2, 2024
@Ben8t
Copy link
Member

Ben8t commented Dec 23, 2024

Indeed there's something wrong in the documentation about the databaseFile, as it's not a proper property.

FYI in the meantime, we have recently fixed an old DuckDB issue: now Kestra use the latest version 1.1.3. The following flow works:

id: duckdb_fil
namespace: kestra.test

tasks:  

  - id: db
    type: io.kestra.plugin.jdbc.duckdb.Queries
    url: jdbc:duckdb:/test_db/data.db  # this file is mounted on my local computer
    sql: |
      CREATE TABLE IF NOT EXISTS t1 (i INTEGER, j INTEGER);
      INSERT INTO t1 VALUES (1, 2);
      SELECT * FROM t1;
    store: true


  - id: db2
    type: io.kestra.plugin.jdbc.duckdb.Query
    url: jdbc:duckdb:/test_db/data.db
    sql: |
      SELECT * FROM t1;
    store: true

@mgabelle can you check why the databaseFile prop isn't accessible from a user pov ? Can you ping me when you have an idea please? We might want to reevulate the overlap between using url: jdbc:duckdb:/test_db/data.db and the databaseFile (which seems the same to me 🤔 )

@Vinceveve
Copy link
Author

Vinceveve commented Jan 6, 2025

url does not support dynamic properties (ie : jdbc:duckdb:{{ inputs.mydb}}).
databaseFile might be here to support this dynamic database property (really useful)

@mgabelle
Copy link
Contributor

mgabelle commented Jan 8, 2025

Just checked and the url property should be dynamic.
I don't know the goal of databaseFile and don't really know why it's not accessible from a user pov

@Vinceveve
Copy link
Author

Vinceveve commented Jan 9, 2025

@mgabelle you're right it should be dynamic, but it's not
CleanShot 2025-01-09 at 11 05 33@2x

  - id: agency_table_exists
    type: io.kestra.plugin.jdbc.duckdb.Query
    url: "jdbc:duckdb:/var/otp/db/agency-{{ inputs.dataset_id }}.db"
    fetchType: FETCH_ONE
    sql: | #sql
      SELECT count(*) as exist FROM duckdb_tables where table_name = '{{ outputs.table.value }}';

@Vinceveve
Copy link
Author

@mgabelle currently 0.20.10, tried it with 0.18.x and 0.19.x

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 bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

3 participants