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

Request to add optional argument to prevent appending semicolon to query statement #16

Open
jmichaelegana opened this issue Jul 4, 2023 · 0 comments · May be fixed by #17
Open

Request to add optional argument to prevent appending semicolon to query statement #16

jmichaelegana opened this issue Jul 4, 2023 · 0 comments · May be fixed by #17

Comments

@jmichaelegana
Copy link

I am trying to use nf-sqldb to access a local Trino database using the code below with working db config trino_db.

include { fromQuery } from 'plugin/nf-sqldb'
query = "select * from sample_table"
ch = channel.fromQuery(query , db: 'trino_db')

The query returns an error:

java.sql.SQLException: Query failed (#20230704_090934_00018_qtmi2): line 1:86: mismatched input ';'. Expecting: <EOF>

Turns out, fromQuery function automatically adds a trailing semicolon when the original query does not already have one. See https://github.com/nextflow-io/nf-sqldb/blob/df3976d6d71ccc3cd4e4995d64da305fa40bfd7f/plugins/nf-sqldb/src/main/nextflow/sql/QueryHandler.groovy#L131C2-L131C2

Some databases/engines like Trino do not like trailing semicolons. If there is a way to work around this problem such as adding an optional argument like trailingSemicolon: false e.g. channel.fromQuery(query , db: 'trino_db', trailingSemicolon: false), it would be greatly appreciated. Thanks!

@bentsherman bentsherman linked a pull request Jul 7, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant