{"record":{"id":"3ceb4f3581220cd3","repo":"pola-rs/polars","slug":"cannot-sink-to-static-iceberg-table-type-target-getattr","errorCode":null,"errorMessage":"cannot sink to static Iceberg table: {type(target) = }, {getattr(target, 'catalog', None) = }","messagePattern":"cannot sink to static Iceberg table: (.+?), (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/iceberg/_sink.py","lineNumber":548,"sourceCode":"            )\n            if isinstance(target, str)\n            else (\n                IcebergCatalogConfig(\n                    class_=type(target.catalog),\n                    name=target.catalog.name,\n                    properties=target.catalog.properties,\n                )\n            )\n        )\n\n        from pyiceberg.catalog.noop import NoopCatalog\n\n        if catalog_config.class_ is NoopCatalog:\n            msg = (\n                \"cannot sink to static Iceberg table: \"\n                f\"{type(target) = }, {getattr(target, 'catalog', None) = }\"\n            )\n            raise TypeError(msg)\n\n        return IcebergSinkState(\n            py_catalog_class_module=catalog_config.class_.__module__,\n            py_catalog_class_qualname=catalog_config.class_.__qualname__,\n            catalog_name=catalog_config.name,\n            catalog_properties=catalog_config.properties,\n            table_name=target if isinstance(target, str) else \".\".join(target.name()),\n            mode=mode,\n            schema_mode=schema_mode,\n            snapshot_properties=snapshot_properties or {},\n            iceberg_storage_properties=storage_options or {},\n            compression=compression,\n            compression_level=compression_level,\n            row_group_size=row_group_size,\n            maintain_order=maintain_order,\n            sink_uuid_str=gen_uuid_v7().hex(),\n            table_=NoPickleOption(target if not isinstance(target, str) else None),\n            source_schema=None,","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/iceberg/_sink.py#L530-L566","documentation":"The resolved catalog is pyiceberg's NoopCatalog, a catalog that performs no persistence. Sinking to such a table would silently discard data, so Polars raises TypeError identifying the target type and its catalog attribute.","triggerScenarios":"Passing a pyiceberg Table loaded from NoopCatalog as target to sink_iceberg / IcebergSinkState.new, or constructing a table whose .catalog is a NoopCatalog (e.g. from pyiceberg static/test helpers).","commonSituations":"Testing code paths with NoopCatalog and then trying to write real data; loading a table via a catalog stub instead of Hive/REST/SQL catalog; forgetting to configure a real catalog.","solutions":["Load the table from a real catalog (SQLCatalog, HiveCatalog, RESTCatalog, etc.) and sink to that","Pass a table identifier string plus a configured catalog= argument instead of a NoopCatalog-backed Table"],"exampleFix":"// before\ntable = NoopCatalog('noop').load_table('db.t')\nlf.sink_iceberg(table)\n// after\ncatalog = load_catalog('prod', **props)\nlf.sink_iceberg('db.t', catalog=catalog)","handlingStrategy":"type-guard","validationCode":"from pyiceberg.catalog.noop import NoopCatalog\nif isinstance(target, Table) and isinstance(target.catalog, NoopCatalog):\n    raise TypeError('target table uses NoopCatalog; cannot sink')","typeGuard":"def is_sinkable_table(target) -> bool:\n    from pyiceberg.catalog.noop import NoopCatalog\n    return not (hasattr(target, 'catalog') and isinstance(target.catalog, NoopCatalog))","tryCatchPattern":"try:\n    lf.sink_iceberg(target, catalog=catalog)\nexcept TypeError as e:\n    if 'static Iceberg table' in str(e):\n        target = catalog.load_table(table_identifier)\n        lf.sink_iceberg(target, catalog=catalog)\n    else:\n        raise","preventionTips":["Never pass tables loaded from NoopCatalog to write operations","Verify the catalog backend (REST/Hive/SQL) before sinking","Use a string identifier plus catalog= argument in tests of real writes"],"tags":["python","polars","iceberg","noop-catalog"],"backgroundTag":"incompatible-source-type","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"}