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()
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.
Hello,
When running the example from the doc:
I'm getting this error:
It looks like the native query parameter isn't working correctly. I'm using an all purpose cluster with a runtime of
14.2with photon acceleration disabled.Thank you!