You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IN clause with list parameter broken in 4.0.4 (regression from 4.0.3) #738
When using use_inline_params=True and passing a Python list as a parameter for an IN clause, the connector incorrectly renders it using ARRAY(...) syntax instead of a parenthesized tuple. This results in invalid SQL that Databricks rejects.
❗ This is a regression: the same code works correctly with version 4.0.3 and fails with 4.0.4.
To Reproduce
from databricks import sql
from databricks.sdk.core import Config, oauth_service_principal
query = """SELECT 'a' WHERE 'a' IN %(foo)s"""
parameters = {"foo": ["a", "b"]}
config = Config(
host=f"https://{DATABRICKS_SERVER_HOSTNAME}",
client_id=DATABRICKS_CLIENT_ID,
client_secret=DATABRICKS_CLIENT_SECRET,
)
def credential_provider():
return oauth_service_principal(config)
with sql.connect(
server_hostname=DATABRICKS_SERVER_HOSTNAME,
http_path=DATABRICKS_HTTP_PATH,
credentials_provider=credential_provider,
use_inline_params=True,
) as connection:
with connection.cursor() as cursor:
cursor.execute(
operation=query,
parameters=parameters,
)
return cursor.fetchall_arrow().to_pandas()
With this pyproject.toml
[project]
name = "minimal-sample"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
"databricks-sdk==0.91.0",
"databricks-sql-connector[pyarrow]==4.0.4",
]
-> Expected behavior
The query should be rendered as:
SELECT 'a' WHERE 'a' IN ('a', 'b')
-> Actual behavior
The query is rendered as:
SELECT 'a' WHERE 'a' IN ARRAY('a','b')
Which causes an error because ARRAY(...) is not valid SQL syntax inside an IN clause.
databricks.sql.exc.ServerOperationError:
[PARSE_SYNTAX_ERROR] Syntax error at or near 'IN'. SQLSTATE: 42601 (line 1, pos 21)
== SQL ==
SELECT 'a' WHERE 'a' IN ARRAY('a','b')
---------------------^^^
Note:
This works perfectly with the 4.0.3 version !!!!
Activity
PaulArnaud commentedon Mar 2, 2026
This is a duplicate from #629