Skip to content

parameterized queries not working #338

@RossHathaway

Description

@RossHathaway

I updated to latest version @databricks/sql v1.13.0 and still got this issue.
I copied this example into my project: https://docs.databricks.com/aws/en/dev-tools/nodejs-sql-driver#query-data

client
  .connect(connectOptions)
  .then(async (client) => {
    const session = await client.openSession();
    const queryOperation = await session.executeStatement('SELECT * FROM my_table LIMIT ?', {
      runAsync: true,
      maxRows: 10000, // This option enables the direct results feature.
      ordinalParameters: [2],
    });

    const result = await queryOperation.fetchAll();
...

and got this error:

OperationStateError: 
extraneous input '?' expecting {<EOF>, ';'}(line 1, pos 66)

When I use a query like SELECT * FROM my_table WHERE col_name = '?' and provide a value in ordinalParameters that works in a nonparameterized query, I get no results back.

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