{"record":{"id":"43c9e22efd3670bf","repo":"pola-rs/polars","slug":"engine-must-be-one-of-connectorx-adbc-got","errorCode":null,"errorMessage":"engine must be one of {'connectorx', 'adbc'}, got {engine!r}","messagePattern":"engine must be one of (.+?), got (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/functions.py","lineNumber":532,"sourceCode":"            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)\n        if pre_execution_query:\n            msg = \"the 'adbc' engine does not support use of `pre_execution_query`\"\n            raise ValueError(msg)\n        return _read_sql_adbc(\n            query,\n            connection_uri=uri,\n            schema_overrides=schema_overrides,\n            execute_options=execute_options,\n        )\n    else:\n        msg = f\"engine must be one of {{'connectorx', 'adbc'}}, got {engine!r}\"\n        raise ValueError(msg)\n","sourceCodeStart":514,"sourceCodeEnd":533,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/io/database/functions.py#L514-L533","documentation":"Raised by read_database_uri() when the engine argument is not 'connectorx' or 'adbc'. Only these two URI engines exist; None defaults to connectorx, anything else is rejected up front.","triggerScenarios":"pl.read_database_uri(query, uri, engine='sqlalchemy') or a typo like 'connector_x', 'ADBC' (case matters).","commonSituations":"Assuming the local database driver name (e.g. 'sqlalchemy', 'psycopg2') is a valid engine; refactors introducing typos; uppercase/lowercase inconsistencies.","solutions":["Use engine='connectorx' (default) or engine='adbc'","Pass engine=None to get the default connectorx behaviour","For SQLAlchemy or driver connections, use pl.read_database() instead"],"exampleFix":"# before\npl.read_database_uri(q, uri, engine=\"sqlalchemy\")\n\n# after\npl.read_database_uri(q, uri, engine=\"connectorx\")\n# or for SQLAlchemy\npl.read_database(q, sqlalchemy_engine.connect())","handlingStrategy":"validation","validationCode":"VALID_ENGINES = {\"connectorx\", \"adbc\", None}\nassert engine in VALID_ENGINES, f\"engine must be one of {VALID_ENGINES}, got {engine!r}\"","typeGuard":"def is_valid_engine(engine: object) -> TypeGuard[str | None]:\n    return engine is None or (isinstance(engine, str) and engine in {\"connectorx\", \"adbc\"})","tryCatchPattern":null,"preventionTips":["Centralise engine selection behind a Literal['connectorx','adbc'] type hint","Let tests assert invalid engines are rejected by your wrapper before polars sees them","Use engine=None rather than misspelling the default"],"tags":["database","engine","validation"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}