Quack Weave documentation
Embed MATCH in a standard SQL FROM clause using the SQL/PGQ GRAPH_TABLE operator. Project typed graph rows and join them to DuckDB tables, files, and other SQL relations.
Native test runtime · DuckDB v2.0.1
Build and connect
Build one Quack Weave extension with Ladybug v0.22.3, RelateDB v1.2.0, and Neo4j Aura support. Use DuckDB v2.0.1 on macOS ARM64 or Linux ARM64.
Install Rust, a C++20 compiler, CMake, Python 3.12 or later, and OpenSSL 3 static libraries. Build the extension and start the pinned DuckDB CLI with -unsigned.
make native-deps && make native-release
/path/to/duckdb-v2.0.1 -unsigned
Load the extension once by its absolute path and list the available providers. Then register the graphs you want to query. Provider setup
LOAD '/path/to/quack-weave/build/native/release/extension/quack_weave/quack_weave.duckdb_extension';
SELECT provider_id, setting_name, active_alias
FROM qw_graph_providers()
ORDER BY provider_id;
Each provider has one registration slot per DuckDB instance. Graph aliases are case-insensitive and unique across providers. Use active_alias to inspect routing after concurrent registration or reset.
Query interfaces
SQL/PGQ with GRAPH_TABLE
Use FROM GRAPH_TABLE to name the registered graph and match a supported labeled pattern. Project graph properties with COLUMNS, then apply SQL joins, subqueries, set operations, or aggregates in DuckDB.
WITH watch(route_id) AS (VALUES (101::BIGINT), (104::BIGINT), (101::BIGINT))
SELECT g.route_id, g.destination, g.miles
FROM GRAPH_TABLE (
air_routes MATCH (o:airport)-[r:route]->(d:airport)
COLUMNS (r.rid AS route_id, d.code AS destination, r.dist AS miles)
) AS g
JOIN watch USING (route_id)
ORDER BY g.route_id;
DuckDB keeps duplicate joins and UNION ALL rows and applies its usual NULL and scalar-subquery rules. Use an outer ORDER BY for deterministic ordering, and AS MATERIALIZED when multiple references should share one graph result.
Explicit-schema reads with qw_query
Use qw_query in a FROM clause. Supply the columns in graph-result order using BOOLEAN, BIGINT, DOUBLE, or VARCHAR. For Cypher, pass named scalar parameters as a DuckDB STRUCT. SQL aliases can rename the projection.
SELECT destination, miles
FROM qw_query(
'air_routes', 'cypher',
$$MATCH (o:airport)-[r:route]->(d:airport)
WHERE o.code = $origin
RETURN d.code AS destination, r.dist AS miles$$,
schema := 'destination VARCHAR, miles BIGINT',
bindings := {'origin': 'ATL'}
);
The explicit-schema GQL bridge accepts a fixed directed MATCH with labeled nodes and a typed relationship, aliased scalar property projections, and an optional property-to-literal comparison. Use ASCII identifiers and omit the trailing semicolon inside the graph text. GQL parse errors use QW_GQL_PARSE, and valid syntax outside this bridge uses QW_GQL_SUBSET.
Standalone graph reads
Quack Weave binds standalone MATCH to the graph selected on the DuckDB connection. Its default dialect is the supported GQL subset. Set qw_graph_dialect to cypher for Cypher. If a connection predates the extension load, enable the grammar there with CALL add_grammar_extension('quack_weave').
SESSION SET GRAPH air_routes;
SET SESSION qw_graph_dialect = 'cypher';
PREPARE flights AS
MATCH (o:airport)-[r:route]->(d:airport)
WHERE o.code = $origin
RETURN d.code AS destination, r.dist AS miles;
EXECUTE flights(origin := 'ATL');
On the Ladybug path, supported node and relationship values project to DuckDB structures, with identity fields such as _ID, _SRC, and _DST. A supported named path carries ordered _NODES and _RELS lists. The explicit-schema bridge remains scalar.
Provider setup
Choose a unique alias for each graph you register. Use those aliases in GRAPH_TABLE and qw_query.
Ladybug
Register an existing .lbdb file with qw_ladybug_config. Reads reuse the registered read-only database handle and open a connection per scan. Optional timeout_ms and max_batch_bytes values must be positive.
SET GLOBAL qw_ladybug_config = '{"alias":"air_routes","path":"/path/to/air_routes.lbdb"}';
RelateDB
Register a checkpointed single-file .rl bundle. Configure it with qw_relate_config. Registration opens a read-only snapshot and ordinarily discovers node and relationship property types. A declared catalog can supply types for empty or uninferable data. Use node:Label and relationship:Type keys when those identities must be distinguished. RelateDB supports the bridge batch limit, and its configuration rejects timeout_ms with QW_CONFIG.
SET GLOBAL qw_relate_config = '{"alias":"relate_routes","path":"/path/to/routes.rl"}';
SELECT * FROM qw_graph_providers() ORDER BY provider_id;
Give Ladybug and RelateDB different aliases to query both in one DuckDB connection. Before replacing an embedded file, reset the provider registration, replace the file and register it again. Reprepare previously bound queries against the new generation.
Neo4j Aura
Configure the Aura database name and HTTPS origin with qw_neo4j_config. The Query API uses Basic authentication and typed JSON. Enable DuckDB external access and the explicit global remote-read switch. Use a Neo4j identity with effective read-only privileges.
CREATE SECRET routes IN connection (
TYPE quack_weave_neo4j,
ORIGIN 'https://example.databases.neo4j.io',
USERNAME 'graph_reader',
PASSWORD '<password>'
);
SET GLOBAL qw_enable_remote_graphs = true;
SET GLOBAL qw_neo4j_config = '{
"alias":"remote_routes",
"endpoint":"https://example.databases.neo4j.io",
"database":"neo4j",
"secret":"routes",
"timeout_ms":5000,
"max_response_bytes":1048576,
"catalog":{"node:airport":{"code":"VARCHAR"}}
}';
SELECT * FROM qw_query(
'remote_routes', 'cypher', 'RETURN 1 AS id', schema := 'id BIGINT'
);
- Named secrets. Provision the same secret name on each connection that queries the graph. Each scan resolves it in that connection, checks the secret type and matches the canonical HTTPS origin. Port
:443is equivalent to the default port. - Rotation and revocation.
CREATE OR REPLACE SECRET routes IN connection (...)affects later scans, including prepared executions.DROP SECRET routes FROM connectionor closing the connection removes that credential. - Environment references. Alternatively configure
"credential_ref":"routes"and the process variablesQW_NEO4J_ROUTES_ENDPOINT,QW_NEO4J_ROUTES_USERNAMEandQW_NEO4J_ROUTES_PASSWORD. The environment endpoint must equal the registered endpoint. Set exactly one reference field. - Remote query interfaces. Use Cypher with an explicit scalar schema or
GRAPH_TABLEwith a catalog for every projected property. Put selective predicates directly in the Cypher passed toqw_queryto reduce the response.
DuckDB's CLI can store literal secret statements in its history. Use your application's credential provisioning path or the environment option for real credentials. DuckDB CREATE SECRET · Neo4j Query API on Aura
Planning and limits
| Behavior | What to expect |
|---|---|
| Projection and filters | On eligible Ladybug and discovered-catalog RelateDB patterns, Quack Weave can fetch only needed properties and send simple graph predicates or small BIGINT equality and IN keys. DuckDB retains the SQL filters. |
| Watchlists | Eligible embedded equality joins can use up to 64 integer keys. A runtime watchlist depends on DuckDB selecting the watchlist as the hash-table build side and producing an exact eligible filter. DuckDB still joins the original rows and keeps duplicates. |
| Aggregates | Eligible embedded scalar COUNT(*) and sums can return one graph row. RelateDB's bounded modulo sums require an observed catalog and an accumulator bound. Other forms use DuckDB's aggregation. |
| Remote graph tables | DuckDB evaluates SQL predicates, joins, and aggregates after the Aura read. Cypher in qw_query can compute the same operation in Aura and return fewer rows. |
| Plans | Use EXPLAIN to inspect eligible graph scans and EXPLAIN (ANALYZE, FORMAT JSON) to inspect rows returned by an executed scan. |
Reads are admitted before dispatch. Embedded file reads obey the host external-access policy. Aura reads require both external access and SET GLOBAL qw_enable_remote_graphs = true. RESET GLOBAL qw_enable_remote_graphs disables new remote scans.
An explicit bridge batch budget bounds bridge-owned output, while an Aura response budget bounds the received HTTP body. Embedded engines can still materialize native results. Authored provider queries and explicitly budgeted reads can preserve their original provider evaluation instead of taking an optimizer rewrite.
| Diagnostic | Check |
|---|---|
QW_CONFIG | Provider settings, alias ownership, and whether a bound graph registration has been replaced. |
QW_ACCESS | DuckDB external access and the remote-read switch. |
QW_AUTH | Credential availability in the executing connection, origin equality, and Aura authentication. |
QW_ADMISSION | A single supported, read-only graph statement. |
QW_SCHEMA | Output names, order, types, and any required declared catalog entries. |
QW_BATCH_BUDGET or QW_RESPONSE_BUDGET | The output batch or HTTP response cap. Reduce the graph result at the source where possible. |
QW_TIMEOUT or QW_TRANSPORT | The configured read deadline or Aura connectivity. |
Client and browser use
The native ADBC example prepares a query, fetches typed Arrow result tables and ingests a graph result into a second DuckDB cursor. Use the matched DuckDB library with the extension. Runnable ADBC example
The browser Playground runs a separate DuckDB Wasm and Ladybug Wasm pair over the bundled PaperTrail citation fixture. It offers browser SQL and Cypher, scalar qw_query, and a SQL/PGQ-style GRAPH_TABLE bridge that transfers typed Arrow rows. The sample alias is kg. The browser runs its own read-only sample graph and SQL session. Open the Playground · Playground source and tests
SQLLogic evidence
The macOS ARM64 runs covered 1,050 distinct SQLLogic blocks across 54 test files with DuckDB v2.0.1. The same 657 blocks passed on both the native debug and release packages, for a total of 1,707 successful block executions. These counts exclude the runtime-version probes.
The standard packages list all three providers. The RelateDB and ADBC suites use the same release file. The Neo4j transport suite exercises credentials and queries against a local TLS fixture.
| Suite | Files | Passed blocks |
|---|---|---|
| Native debug | 31 | 657 |
| Native release | 31 | 657 |
| Native observer | 1 | 25 |
| RelateDB and Ladybug | 17 | 280 |
| Neo4j local TLS fixture | 4 | 76 |
| Public ADBC client | 1 | 12 |
| Area | Evidence examples |
|---|---|
| Query admission and typed reads | reads.test, admission.test, declared_bindings.test, graph_parameters.test |
| Standalone GQL and graph values | graph_entry.test, duckgql_*.test, graph_values.test |
| Hybrid SQL and embedded planning | native_surface.test joins GRAPH_TABLE to typed Cypher in one SQL statement. graph_table.test, hybrid_public.test, graph_aggregate_pushdown.test, table_watchlist.test, and the RelateDB SQLLogic cases cover planning and SQL composition. |
| Provider lifecycle and safety | host_access.test, remote_policy.test, scan.test, provider_inventory.test, provider_alias_race.test |
| Neo4j and credentials | provider.test, hybrid.test, credential_registration.test, credential_scan.test with a local TLS Query API fixture |
| ADBC result parity | test/public_client/results.test checks output rows and Arrow ingest results |
Download the SQLLogic and solver evidence manifest for recorded suites, block counts, test-file hashes, claim mappings and the Jev/Z3 results. The solver checks that each listed claim references a passed test file in the recorded snapshot. Runtime behavior comes from those tests.
make native-stabilization-test DUCKDB_UNITTEST=/path/to/unittest LBUG=/path/to/lbug
make native-provider-test DUCKDB_UNITTEST=/path/to/unittest LBUG=/path/to/lbug
make public-client-test DUCKDB_UNITTEST=/path/to/unittest DUCKDB_LIB=/path/to/libduckdb.dylib LBUG=/path/to/lbug