{"record":{"id":"b54a4735f25dfa96","repo":"pola-rs/polars","slug":"sink-to-iceberg-table-with-custom-location-provide","errorCode":null,"errorMessage":"sink to Iceberg table with custom location provider '{location_provider_impl}'","messagePattern":"sink to Iceberg table with custom location provider '(.+?)'","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/iceberg/_sink.py","lineNumber":659,"sourceCode":"        if self.schema_mode == \"overwrite\" and table.spec().fields:\n            msg = \"schema_mode='overwrite' is not supported for partitioned Iceberg tables\"\n            raise NotImplementedError(msg)\n\n        partition_key_exprs = _partition_key_exprs(table, self.source_schema)\n\n        sort_order = table.sort_order()\n        if sort_order.fields and self.schema_mode == \"overwrite\":\n            msg = \"schema_mode='overwrite' is not supported for Iceberg tables with a sort order\"\n            raise NotImplementedError(msg)\n\n        if location_provider_impl := table_properties.get(\n            TableProperties.WRITE_PY_LOCATION_PROVIDER_IMPL\n        ):\n            msg = (\n                \"sink to Iceberg table with custom location provider\"\n                f\" '{location_provider_impl}'\"\n            )\n            raise NotImplementedError(msg)\n\n        object_storage_enabled = property_as_bool(\n            table_properties,\n            TableProperties.OBJECT_STORE_ENABLED,\n            TableProperties.OBJECT_STORE_ENABLED_DEFAULT,\n        )\n        object_storage_partitioned_paths = (\n            property_as_bool(\n                table_properties,\n                TableProperties.WRITE_OBJECT_STORE_PARTITIONED_PATHS,\n                TableProperties.WRITE_OBJECT_STORE_PARTITIONED_PATHS_DEFAULT,\n            )\n            if object_storage_enabled\n            else None\n        )\n\n        schema, arrow_schema = self._schemas_for_write(table)\n        lf = wrap_ldf(plf)","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/iceberg/_sink.py#L641-L677","documentation":"The table property write.py.location-provider-impl registers a custom Python location provider. Polars' sink cannot honor a custom location provider when committing Iceberg data files, so it refuses with NotImplementedError naming the configured provider.","triggerScenarios":"Sinking to a table whose metadata properties include TableProperties.WRITE_PY_LOCATION_PROVIDER_IMPL (a custom location provider class), via sink_iceberg with any mode.","commonSituations":"Tables configured with a custom location-provider implementation (e.g. for non-standard object-store layouts) being written to through Polars' sink instead of pyiceberg itself.","solutions":["Remove the write.py.location-provider-impl property from the target table so default path resolution is used","Write to that table with pyiceberg's native append/overwrite instead of Polars' sink","Sink to a different table without the custom location provider"],"exampleFix":"// before\ntable.properties['write.py.location-provider-impl'] = 'my_mod.MyProvider'\nlf.sink_iceberg(table)\n// after\ndel table.properties['write.py.location-provider-impl']\nlf.sink_iceberg(table)","handlingStrategy":"validation","validationCode":"from pyiceberg.table.properties import TableProperties\nif TableProperties.WRITE_PY_LOCATION_PROVIDER_IMPL in table.properties:\n    raise NotImplementedError('custom location provider table is not sinkable')","typeGuard":null,"tryCatchPattern":"try:\n    lf.sink_iceberg(table)\nexcept NotImplementedError as e:\n    if 'custom location provider' in str(e):\n        table.properties.pop(TableProperties.WRITE_PY_LOCATION_PROVIDER_IMPL, None)\n        lf.sink_iceberg(table)\n    else:\n        raise","preventionTips":["Check table metadata properties for write.py.location-provider-impl before sinking","Keep custom location providers on tables written via pyiceberg directly","Use default path layout for tables intended as Polars sink targets"],"tags":["python","polars","iceberg","location-provider"],"backgroundTag":"operation-not-supported","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"}