{"record":{"id":"6be7d466ba9fcfab","repo":"pola-rs/polars","slug":"cannot-apply-delta-table-options-for-table-of-type","errorCode":null,"errorMessage":"cannot apply delta_table_options for table of type {data_source_format}","messagePattern":"cannot apply delta_table_options for table of type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/catalog/unity/client.py","lineNumber":281,"sourceCode":"                version=delta_table_version,\n                delta_table_options=delta_table_options,\n                storage_options=storage_options,\n                credential_provider=credential_provider,\n            )\n\n        if delta_table_version is not None:\n            msg = (\n                \"cannot apply delta_table_version for table of type \"\n                f\"{data_source_format}\"\n            )\n            raise ValueError(msg)\n\n        if delta_table_options is not None:\n            msg = (\n                \"cannot apply delta_table_options for table of type \"\n                f\"{data_source_format}\"\n            )\n            raise ValueError(msg)\n\n        return wrap_ldf(\n            self._client.scan_table(\n                catalog_name,\n                namespace,\n                table_name,\n                credential_provider=credential_provider,\n                cloud_options=storage_options,\n            )\n        )\n\n    def write_table(\n        self,\n        df: DataFrame,\n        catalog_name: str,\n        namespace: str,\n        table_name: str,\n        *,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/catalog/unity/client.py#L263-L299","documentation":"`scan_table` raises ValueError when `delta_table_options` is provided for a table whose format is not Delta Lake. Delta reader options (e.g. version, timestamp-as-of style settings) only apply to Delta sources, so passing them for PARQUET/CSV/other formats is rejected rather than silently ignored.","triggerScenarios":"Calling `scan_table(..., delta_table_options={...})` (or via scan_unity_catalog_table) against a table whose `data_source_format` is not DELTA.","commonSituations":"Reusing a scan-options dict built for Delta tables across heterogeneous tables; scripted scans that always pass the same kwargs regardless of table type.","solutions":["Only pass `delta_table_options` when the table format is DELTA — gate the kwargs on the detected format","Remove the option for non-Delta tables","Branch your scanning helper: one path for Delta (with options), one for other formats"],"exampleFix":"// before\npl.scan_unity_catalog_table(\"c\", \"s\", \"t\", delta_table_options={\"versionAsOf\": 2})  # non-Delta\n// after\nopts = {\"versionAsOf\": 2} if fmt == \"DELTA\" else None\npl.scan_unity_catalog_table(\"c\", \"s\", \"t\", delta_table_options=opts)","handlingStrategy":"validation","validationCode":"info = client.get_table(catalog, ns, table)\nif info.data_source_format != 'DELTA' and delta_table_options:\n    raise ValueError('delta_table_options only apply to DELTA tables')","typeGuard":"def is_delta_format(fmt: str) -> bool:\n    return fmt.upper() == 'DELTA'","tryCatchPattern":"try:\n    lf = client.scan_table(c, n, t, delta_table_options=opts)\nexcept ValueError as e:\n    if 'delta_table_options' in str(e):\n        lf = client.scan_table(c, n, t)\n    else:\n        raise","preventionTips":["Build scan kwargs conditionally based on the table format","Centralize option handling in a helper that inspects the format first","Avoid blanket reuse of one kwargs dict across all tables"],"tags":["python","databricks","delta-lake","api-misuse"],"backgroundTag":"conflicting-config-options","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"}