Skip to content

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

Open
@jmichaelegana

Description

@jmichaelegana

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions