{"record":{"id":"04d8f82c7ba46a67","repo":"pola-rs/polars","slug":"the-connectorx-engine-does-not-support-use-of-e","errorCode":null,"errorMessage":"the 'connectorx' engine does not support use of `execute_options`","messagePattern":"the 'connectorx' engine does not support use of `execute_options`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/functions.py","lineNumber":503,"sourceCode":"    >>> df = pl.read_database_uri(\n    ...     \"SELECT * FROM employees WHERE hourly_rate BETWEEN ? AND ?\",\n    ...     \"sqlite:///:memory:\",\n    ...     engine=\"adbc\",\n    ...     execute_options={\"parameters\": (40, 20)},\n    ... )  # doctest: +SKIP\n    \"\"\"\n    from polars.io.database._utils import _read_sql_adbc, _read_sql_connectorx\n\n    if not isinstance(uri, str):\n        msg = f\"expected connection to be a URI string; found {qualified_type_name(uri)!r}\"\n        raise TypeError(msg)\n    elif engine is None:\n        engine = \"connectorx\"\n\n    if engine == \"connectorx\":\n        if execute_options:\n            msg = \"the 'connectorx' engine does not support use of `execute_options`\"\n            raise ValueError(msg)\n        if pre_execution_query:\n            issue_unstable_warning(\n                \"the 'pre-execution-query' parameter is considered unstable.\"\n            )\n        return _read_sql_connectorx(\n            query,\n            connection_uri=uri,\n            partition_on=partition_on,\n            partition_range=partition_range,\n            partition_num=partition_num,\n            protocol=protocol,\n            schema_overrides=schema_overrides,\n            pre_execution_query=pre_execution_query,\n        )\n    elif engine == \"adbc\":\n        if not isinstance(query, str):\n            msg = f\"only a single SQL query string is accepted for adbc, got a {qualified_type_name(query)!r} type\"\n            raise ValueError(msg)","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/database/functions.py#L485-L521","documentation":"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.","triggerScenarios":"Calling `read_database_uri(\"SELECT * FROM t WHERE id = ?\", uri, execute_options={...})` without engine=\"adbc\", or explicitly with engine=\"connectorx\".","commonSituations":"Porting parameterized read_database/adbc code to read_database_uri; forgetting that the default engine is connectorx; assuming URI-based reads support bound parameters.","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)."],"exampleFix":"// before\npl.read_database_uri(q, uri, execute_options={\"parameters\": [1]})  # raises (connectorx default)\n// after\npl.read_database_uri(q, uri, engine=\"adbc\", execute_options={\"parameters\": [1]})","handlingStrategy":"validation","validationCode":"if execute_options and engine in (None, \"connectorx\"):\n    raise ValueError(\"execute_options requires engine='adbc'\")","typeGuard":null,"tryCatchPattern":"try:\n    df = pl.read_database_uri(q, uri, engine=engine, execute_options=opts)\nexcept ValueError as e:\n    if \"execute_options\" in str(e):\n        df = pl.read_database_uri(q, uri, engine=\"adbc\", execute_options=opts)\n    else:\n        raise","preventionTips":["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"],"tags":["polars","connectorx","parameterized-query","unsupported-feature"],"backgroundTag":"unsupported-operation","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}