pola-rs/polars · error · ValueError
the 'connectorx' engine does not support use of…
Error message
the 'connectorx' engine does not support use of `execute_options`
What it means
Capability check in read_database_uri: the connectorx engine has no way to pass parameter bind values, so supplying execute_options together with engine='connectorx' (the default) is rejected. Use the adbc engine or drop execute_options.
Solutions
- Use `engine="adbc"` in read_database_uri when you need execute_options.
- Or use `read_database` with a DBAPI connection, which supports parameterized queries.
- Inline the parameter values into the SQL string safely (or via a view/temp table).
Example fix
// before
pl.read_database_uri(q, uri, execute_options={"parameters": [1]}) # raises (connectorx default)
// after
pl.read_database_uri(q, uri, engine="adbc", execute_options={"parameters": [1]}) Defensive patterns
Strategy: validation
Validate before calling
if execute_options and engine in (None, "connectorx"):
raise ValueError("execute_options requires engine='adbc'") Try / catch
try:
df = pl.read_database_uri(q, uri, engine=engine, execute_options=opts)
except ValueError as e:
if "execute_options" in str(e):
df = pl.read_database_uri(q, uri, engine="adbc", execute_options=opts)
else:
raise Prevention
- Default engine is connectorx — set engine="adbc" explicitly when binding parameters
- Keep a helper that selects the engine based on whether parameters are present
- Document in team conventions that connectorx is parameter-free
When it happens
Trigger: Calling `read_database_uri("SELECT * FROM t WHERE id = ?", uri, execute_options={...})` without engine="adbc", or explicitly with engine="connectorx".
Common situations: Porting parameterized read_database/adbc code to read_database_uri; forgetting that the default engine is connectorx; assuming URI-based reads support bound parameters.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- 'pre_execution_query' is only supported in connectorx…
- pyarrow is required for adbc-driver-manager <
- pyarrow is required for adbc-driver-manager <
- {0}
- a more recent version of `fastexcel` is required for…
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/04d8f82c7ba46a67.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/database/functions.py:503
>>> df = pl.read_database_uri(
... "SELECT * FROM employees WHERE hourly_rate BETWEEN ? AND ?",
... "sqlite:///:memory:",
... engine="adbc",
... execute_options={"parameters": (40, 20)},
... ) # doctest: +SKIP
"""
from polars.io.database._utils import _read_sql_adbc, _read_sql_connectorx
if not isinstance(uri, str):
msg = f"expected connection to be a URI string; found {qualified_type_name(uri)!r}"
raise TypeError(msg)
elif engine is None:
engine = "connectorx"
if engine == "connectorx":
if execute_options:
msg = "the 'connectorx' engine does not support use of `execute_options`"
raise ValueError(msg)
if pre_execution_query:
issue_unstable_warning(
"the 'pre-execution-query' parameter is considered unstable."
)
return _read_sql_connectorx(
query,
connection_uri=uri,
partition_on=partition_on,
partition_range=partition_range,
partition_num=partition_num,
protocol=protocol,
schema_overrides=schema_overrides,
pre_execution_query=pre_execution_query,
)
elif engine == "adbc":
if not isinstance(query, str):
msg = f"only a single SQL query string is accepted for adbc, got a {qualified_type_name(query)!r} type"
raise ValueError(msg)View on GitHub (pinned to fe841f959e)