{"record":{"id":"a6d072fd6412fcea","repo":"pola-rs/polars","slug":"sink-csv-is-not-supported-by-type-self-name","errorCode":null,"errorMessage":"`sink_csv` is not supported by {type(self).__name__}","messagePattern":"`sink_csv` is not supported by (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/engine.py","lineNumber":260,"sourceCode":"        batch_size: int,\n        datetime_format: str | None,\n        date_format: str | None,\n        time_format: str | None,\n        float_scientific: bool | None,\n        float_precision: int | None,\n        decimal_comma: bool,\n        null_value: str | None,\n        quote_style: CsvQuoteStyle | None,\n        maintain_order: bool,\n        storage_options: StorageOptionsDict | None,\n        credential_provider: CredentialProviderFunction | Literal[\"auto\"] | None,\n        sync_on_close: SyncOnCloseMethod | None,\n        mkdir: bool,\n        optimizations: QueryOptFlags,\n    ) -> None:\n        \"\"\"See :meth:`polars.LazyFrame.sink_csv`.\"\"\"\n        msg = f\"`sink_csv` is not supported by {type(self).__name__}\"\n        raise NotImplementedError(msg)\n\n    def sink_ndjson(\n        self,\n        lf: LazyFrame,\n        path: str | Path | IO[bytes] | IO[str] | PartitionBy,\n        *,\n        compression: Literal[\"uncompressed\", \"gzip\", \"zstd\"],\n        compression_level: int | None,\n        check_extension: bool,\n        maintain_order: bool,\n        storage_options: StorageOptionsDict | None,\n        credential_provider: CredentialProviderFunction | Literal[\"auto\"] | None,\n        sync_on_close: SyncOnCloseMethod | None,\n        mkdir: bool,\n        optimizations: QueryOptFlags,\n    ) -> None:\n        \"\"\"See :meth:`polars.LazyFrame.sink_ndjson`.\"\"\"\n        msg = f\"`sink_ndjson` is not supported by {type(self).__name__}\"","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/lazyframe/engine.py#L242-L278","documentation":"Interface guard on the lazy engine wrapper classes: a particular engine (e.g. the in-memory/streaming engine) does not implement the sink_csv plan node, so calling LazyFrame.sink_csv routed through it raises naming the engine class that lacks support.","triggerScenarios":"Calling `LazyFrame.sink_csv(..., engine=<engine>)` where the engine class does not override `sink_csv` (e.g. custom engine).","commonSituations":"CSV export pipelines with a custom or non-streaming engine; code shared across engine configurations.","solutions":["Use `engine='streaming'` which supports `sink_csv`.","Use `lf.collect().write_csv(path)` as a non-sinking alternative.","Implement `sink_csv` in your custom Engine subclass.","Confirm sink support in the engine's documentation."],"exampleFix":"// before\nlf.sink_csv(\"out.csv\", engine=\"custom\")\n// after\nlf.sink_csv(\"out.csv\", engine=\"streaming\")","handlingStrategy":"try-catch","validationCode":"if type(engine_obj).sink_csv is Engine.sink_csv:\n    engine = \"streaming\"","typeGuard":"def supports_csv_sink(engine: object) -> bool:\n    return type(engine).sink_csv is not Engine.sink_csv","tryCatchPattern":"try:\n    lf.sink_csv(path, engine=eng)\nexcept NotImplementedError:\n    lf.collect().write_csv(path)","preventionTips":["Use engine='streaming' for CSV sinks","Add NotImplementedError fallbacks in shared utilities","Verify engine support before adopting sink APIs"],"tags":["python","polars","csv","sink","not-implemented"],"backgroundTag":"method-not-implemented","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"}