--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: nats_rw excerpt: | DuckDB Community Extensions Read and write NATS JetStream streams with SQL extension: name: nats_rw description: Read and write NATS JetStream streams with SQL version: 0.1.0 language: C++ build: cmake license: BSL 1.1 requires_toolchains: rust excluded_platforms: "osx_amd64;osx_arm64;wasm_mvp;wasm_eh;wasm_threads" maintainers: - robert-guangzhou - xiehuiqiang repo: github: robert-guangzhou/duckdb-nats-rw ref: 34776855201e614ed4f94ab3a861c34285698569 docs: hello_world: | -- Write query results to a NATS JetStream stream COPY (SELECT 'hello' AS v) TO 'my_stream' (FORMAT nats_rw, url 'nats://localhost:4222', create_stream 'true'); -- Read it back SELECT * FROM nats_rw_scan('my_stream', url := 'nats://localhost:4222'); -- Extract JSON fields as columns SELECT device_id, location_zone FROM nats_rw_scan('my_stream', url := 'nats://localhost:4222', json_extract := ['device_id', 'location.zone']); extended_description: | The nats_rw extension provides bidirectional NATS JetStream access from DuckDB: - **Read**: `nats_rw_scan()` table function — bounded snapshot scan with subject filtering, sequence/time ranges, JSON field extraction, and predicate pushdown (WHERE seq/ts_nats automatically narrows the scan range) - **Write**: `COPY … TO '' (FORMAT nats_rw)` — publish query results with optional payload_column, subject_prefix, and auto stream creation - **Auth**: `CREATE SECRET (TYPE nats_rw, …)` — user/password, token, nkey, or credentials file, with scope-based auto-matching - **Metadata**: `nats_rw_streams()` and `nats_rw_stream_info()` for inspection - **Performance**: connection pooling (per-url cache) + predicate pushdown Connections are cached per (url, auth) for efficient repeated queries. Documentation: https://github.com/robert-guangzhou/duckdb-nats-rw extension_star_count: 0 extension_star_count_pretty: 0 extension_download_count: null extension_download_count_pretty: n/a image: '/images/community_extensions/social_preview/preview_community_extension_nats_rw.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 | | :--- | :---: | :---: | :---: | :---: | :---: | | Linux AMD64 | ❌ | ❌ | ❌ | ❌ | ✅ | | Linux ARM64 | ❌ | ❌ | ❌ | ❌ | ✅ | | macOS AMD64 | ❌ | ❌ | ❌ | ❌ | ❌ | | macOS ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | Windows AMD64 | ❌ | ❌ | ❌ | ❌ | ✅ | | Windows ARM64 | ❌ | ❌ | ❌ | ❌ | ❌ | | WebAssembly | ❌ | ❌ | ❌ | ❌ | ❌ | ### Installing and Loading ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### Added Functions
| function_name | function_type | description | comment | examples | |---------------------|---------------|-------------|---------|----------| | nats_rw_scan | table | NULL | NULL | | | nats_rw_stream_info | table | NULL | NULL | | | nats_rw_streams | table | NULL | NULL | | | nats_rw_version | scalar | NULL | NULL | | ### Overloaded Functions
This extension does not add any function overloads. ### Added Types
This extension does not add any types. ### Added Settings
| name | description | input_type | scope | aliases | typed_value | |----------------|---------------------------------------------------------|------------|--------|---------|-------------| | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |