{"record":{"id":"43c9e22efd3670bf","repo":"pola-rs/polars","slug":"engine-must-be-one-of-connectorx-adbc-got-engine-r","errorCode":null,"errorMessage":"engine must be one of {'connectorx', 'adbc'}, got {engine!r}","messagePattern":"engine must be one of (.+?), got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/functions.py","lineNumber":533,"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":515,"sourceCodeEnd":534,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/database/functions.py#L515-L534","documentation":"read_database_uri only accepts engine values 'connectorx' or 'adbc'. Any other string falls into the final else branch and raises ValueError. Use read_database with a connection object for other drivers (e.g. sqlalchemy-based engines).","triggerScenarios":"pl.read_database_uri(query, uri, engine='psycopg') or any misspelled/other engine string.","commonSituations":"Typo like 'ConnectorX' or 'Connectorx' (case-sensitive), or passing an engine name valid for read_database (e.g. 'sqlalchemy') to read_database_uri instead.","solutions":["Pass engine='connectorx' or engine='adbc' exactly (lowercase)","Use pl.read_database with a DBAPI2/sqlalchemy connection for other engines","Check the installed engine extra: pip install 'polars[connectorx]' or 'polars[adbc]'"],"exampleFix":"// before\npl.read_database_uri('SELECT * FROM t', uri, engine='sqlalchemy')\n// after\npl.read_database_uri('SELECT * FROM t', uri, engine='connectorx')","handlingStrategy":"validation","validationCode":"ALLOWED = {'connectorx', 'adbc'}\nif engine not in ALLOWED:\n    raise ValueError(f'engine must be one of {ALLOWED}, got {engine!r}')","typeGuard":null,"tryCatchPattern":"try:\n    df = pl.read_database_uri(q, uri, engine=engine)\nexcept ValueError as e:\n    if 'engine must be one of' in str(e):\n        df = pl.read_database(q, connection=conn)","preventionTips":["Use the exact lowercase literals 'connectorx' or 'adbc'","Use pl.read_database with a live connection object when your driver is not supported by read_database_uri","Install the matching extra: polars[connectorx] or polars[adbc]"],"tags":["python","polars","database","invalid-enum-value"],"backgroundTag":"invalid-enum-value","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"}