Skip to content

How to use query parameters with latest sqlalchemy dialect? #426

Description

@noctuid

This may be a dumb question, but it's not exactly clear how to do query parameters specifically with sqlalchemy 2 from docs/parameters.md. For the old sqlalchemy dialect on databricks-sql-connector 2.7.0, something like conn.execute(sqlalchemy.text("CREATE TABLE foo (col1 STRING COMMENT :comment1, ...) ..."), {"comment1": "foo", ...}) works fine. With sqlalchemy 2 and databricks-sql-connector 3.3.0, this gives an error like [PARSE_SYNTAX_ERROR] Syntax error at or near ':'. I tried alternate syntaxes, text(...).bindparams, etc. but wasn't able to get it working.

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