Skip to content

UNBOUND_SQL_PARAMETER when running the example with 14.2 #288

Description

@Falydoor

Hello,

When running the example from the doc:

from databricks import sql

connection = sql.connect(
  server_hostname=HOSTNAME,
  http_path=HTTP_PATH,
  access_token=TOKEN)

cursor = connection.cursor()
cursor.execute('SELECT :param `p`, * FROM RANGE(10)', {"param": "foo"})
result = cursor.fetchall()
for row in result:
  print(row)

cursor.close()
connection.close()

I'm getting this error:

Traceback (most recent call last):
  File "/Users/theo/Documents/perso/dbx/main.py", line 34, in <module>
    cursor.execute('SELECT :param `p`, * FROM RANGE(10)', {"param": "foo"})
  File "/Users/theo/Documents/perso/dbx/.env/lib/python3.11/site-packages/databricks/sql/client.py", line 761, in execute
    execute_response = self.thrift_backend.execute_command(
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/theo/Documents/perso/dbx/.env/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 867, in execute_command
    return self._handle_execute_response(resp, cursor)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/theo/Documents/perso/dbx/.env/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 959, in _handle_execute_response
    final_operation_state = self._wait_until_command_done(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/theo/Documents/perso/dbx/.env/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 792, in _wait_until_command_done
    self._check_command_not_in_error_or_closed_state(
  File "/Users/theo/Documents/perso/dbx/.env/lib/python3.11/site-packages/databricks/sql/thrift_backend.py", line 596, in _check_command_not_in_error_or_closed_state
    raise ServerOperationError(
databricks.sql.exc.ServerOperationError: [UNBOUND_SQL_PARAMETER] Found the unbound parameter: param. Please, fix `args` and provide a mapping of the parameter to either a SQL literal or collection constructor functions such as `map()`, `array()`, `struct()`. SQLSTATE: 42P02; line 1 pos 7

It looks like the native query parameter isn't working correctly. I'm using an all purpose cluster with a runtime of 14.2 with photon acceleration disabled.

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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