{"record":{"id":"41f3b153bc258e2c","repo":"pola-rs/polars","slug":"only-a-single-sql-query-string-is-accepted-for-adb","errorCode":null,"errorMessage":"only a single SQL query string is accepted for adbc, got a {qualified_type_name(query)!r} type","messagePattern":"only a single SQL query string is accepted for adbc, got a (.+?) type","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/database/functions.py","lineNumber":520,"sourceCode":"            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)\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":502,"sourceCodeEnd":533,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/io/database/functions.py#L502-L533","documentation":"Raised by read_database_uri() when engine='adbc' and query is not a single string. Unlike connectorx, which can take multiple queries, the ADBC path executes exactly one SQL statement per call.","triggerScenarios":"pl.read_database_uri(['SELECT ...', 'SELECT ...'], uri, engine='adbc'); passing a tuple of queries or a non-str object.","commonSituations":"Reusing a multi-query list that worked with the connectorx engine; generic code that batches several statements and chooses the engine dynamically.","solutions":["Pass one SQL string per call and loop over the queries yourself","Or use engine='connectorx', which accepts multiple queries in one call","Check the return shape: adbc returns a single DataFrame per call"],"exampleFix":"# before\npl.read_database_uri([q1, q2], uri, engine=\"adbc\")\n\n# after\nframes = [pl.read_database_uri(q, uri, engine=\"adbc\") for q in (q1, q2)]","handlingStrategy":"type-guard","validationCode":"queries = [query] if isinstance(query, str) else list(query)\nframes = [pl.read_database_uri(q, uri, engine=\"adbc\") for q in queries]","typeGuard":"def is_single_query(query: object) -> TypeGuard[str]:\n    return isinstance(query, str)","tryCatchPattern":null,"preventionTips":["Normalise query inputs to a list of strings and loop when engine='adbc'","Reserve multi-query batches for the connectorx engine","Validate query type in shared wrappers before dispatching to an engine"],"tags":["database","adbc","validation"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}