{"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":278,"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":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/catalog/unity/client.py#L260-L296","documentation":"ValueError from the Unity Catalog scan path (py-polars/src/polars/catalog/unity/client.py:270-280). Catalog.read_table / scan-style entry points accept delta_table_version, but only for tables whose data_source_format is DELTA (that branch returns early via scan_delta). For any other format (PARQUET, CSV, JSON, UNITY_*) a non-None delta_table_version is meaningless — Delta time-travel metadata does not exist — so it is rejected instead of silently ignored.","triggerScenarios":"catalog.read_table('cat.schema.tbl', delta_table_version=3) where the table's data_source_format is PARQUET/CSV/JSON rather than DELTA.","commonSituations":"Generic read wrappers that always forward a version flag; assuming all Unity Catalog tables are Delta; tables converted to Parquet/UNITY format between environments.","solutions":["Drop delta_table_version for non-Delta tables (read the latest snapshot)","If time travel is required, ensure the table is actually a Delta table (DESCRIBE TABLE EXTENDED / format checks)","Make the wrapper conditional: pass version only when data_source_format == 'DELTA'"],"exampleFix":"# before\nldf = catalog.read_table('cat.ns.tbl', delta_table_version=2)  # table is PARQUET\n\n# after\nfmt = catalog.get_table('cat.ns.tbl').data_source_format\nldf = catalog.read_table('cat.ns.tbl', delta_table_version=2 if fmt == 'DELTA' else None)","handlingStrategy":"validation","validationCode":"def can_time_travel(table_info) -> bool:\n    return str(table_info.data_source_format).endswith('DELTA')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inspect data_source_format (catalog.get_table / table_info) before passing delta_table_version","Forward version options only when the format is DELTA in wrapper code","Treat time-travel parameters as Delta-only by design"],"tags":["polars","unity-catalog","delta","time-travel","valueerror"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}