{"record":{"id":"01d30976c084337a","repo":"pola-rs/polars","slug":"cannot-apply-delta-table-version-for-table-of-type","errorCode":null,"errorMessage":"cannot apply delta_table_version for table of type {data_source_format}","messagePattern":"cannot apply delta_table_version for table of type (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/catalog/unity/client.py","lineNumber":274,"sourceCode":"        )\n\n        if data_source_format in [\"DELTA\", \"DELTASHARING\"]:\n            from polars.io.delta import scan_delta\n\n            return scan_delta(\n                storage_location,\n                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","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/catalog/unity/client.py#L256-L292","documentation":"`scan_table` raises ValueError when `delta_table_version` is supplied for a table whose `data_source_format` is not Delta Lake. Version/time-travel reads are a Delta-specific feature; other formats (PARQUET, CSV, etc.) have no version history, so the parameter cannot be honored. The error names the actual format detected server-side.","triggerScenarios":"Calling `client.scan_table(catalog, ns, table, delta_table_version=3)` (or the higher-level `pl.scan_unity_catalog_table(..., delta_table_version=n)`) where the table's format is e.g. PARQUET.","commonSituations":"Assuming every Unity Catalog table is a Delta table; pointing a Delta-specific option set at a plain external parquet table; drift where a table was converted from Delta to another format.","solutions":["Remove `delta_table_version` for non-Delta tables, or scan the table without time travel","Check the table's format (e.g. via the Unity Catalog REST API / catalog explorer) before passing Delta options","Convert the table to Delta Lake if versioned reads are genuinely needed"],"exampleFix":"// before\nlf = pl.scan_unity_catalog_table(\"cat\", \"sch\", \"tbl\", delta_table_version=3)  # PARQUET table\n// after\nlf = pl.scan_unity_catalog_table(\"cat\", \"sch\", \"tbl\")  # drop Delta-only option","handlingStrategy":"validation","validationCode":"info = client.get_table(catalog, ns, table)\nif info.data_source_format != 'DELTA' and delta_table_version is not None:\n    raise ValueError('delta_table_version only applies to DELTA tables')","typeGuard":"def supports_delta_version(fmt: str) -> bool:\n    return fmt.upper() == 'DELTA'","tryCatchPattern":"try:\n    lf = client.scan_table(c, n, t, delta_table_version=ver)\nexcept ValueError as e:\n    if 'delta_table_version' in str(e):\n        lf = client.scan_table(c, n, t)  # scan without time travel\n    else:\n        raise","preventionTips":["Look up the table's data_source_format before passing Delta-specific kwargs","Keep Delta and non-Delta scan code paths separate","Confirm tables are Delta-managed when relying on time travel"],"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"}