{"record":{"id":"ba99001bf756a46e","repo":"pola-rs/polars","slug":"sink-ndjson-is-not-supported-by-type-self-na","errorCode":null,"errorMessage":"`sink_ndjson` is not supported by {type(self).__name__}","messagePattern":"`sink_ndjson` is not supported by (.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/lazyframe/engine.py","lineNumber":279,"sourceCode":"\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__}\"\n        raise NotImplementedError(msg)\n\n    def sink_batches(\n        self,\n        lf: LazyFrame,\n        function: Callable[[DataFrame], bool | None],\n        *,\n        chunk_size: int | None,\n        maintain_order: bool,\n        optimizations: QueryOptFlags,\n    ) -> None:\n        \"\"\"See :meth:`polars.LazyFrame.sink_batches`.\"\"\"\n        msg = f\"`sink_batches` is not supported by {type(self).__name__}\"\n        raise NotImplementedError(msg)\n\n\nclass _LocalEngine(Engine):\n    \"\"\"Base for in-process engines backed by `PyLazyFrame`.\"\"\"\n","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/lazyframe/engine.py#L261-L297","documentation":"`sink_ndjson` streams a LazyFrame to newline-delimited JSON and is only implemented by sink-capable engines. The base `Engine` class raises NotImplementedError with this message for engines without the method.","triggerScenarios":"Calling `LazyFrame.sink_ndjson(..., engine=<engine>)` with an engine lacking the `sink_ndjson` override.","commonSituations":"NDJSON export jobs with a custom engine; streaming examples run with a different engine selection.","solutions":["Use `engine='streaming'`.","Fallback: `lf.collect().write_ndjson(path)`.","Implement `sink_ndjson` in your custom Engine.","Verify engine sink capabilities before use."],"exampleFix":"// before\nlf.sink_ndjson(\"out.ndjson\", engine=\"custom\")\n// after\nlf.sink_ndjson(\"out.ndjson\", engine=\"streaming\")","handlingStrategy":"try-catch","validationCode":"if type(engine_obj).sink_ndjson is Engine.sink_ndjson:\n    engine = \"streaming\"","typeGuard":"def supports_ndjson_sink(engine: object) -> bool:\n    return type(engine).sink_ndjson is not Engine.sink_ndjson","tryCatchPattern":"try:\n    lf.sink_ndjson(path, engine=eng)\nexcept NotImplementedError:\n    lf.collect().write_ndjson(path)","preventionTips":["Use engine='streaming' for NDJSON sinks","Implement sink methods when subclassing Engine","Keep non-sinking export fallbacks"],"tags":["python","polars","ndjson","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"}