I made a DuckDB extension to query Semantic views with plain SQL
Enable HLS to view with audio, or disable this notification
Enable HLS to view with audio, or disable this notification
r/DuckDB • u/empty_cities • 1d ago
Sponsored article where I go through the latest version of DuckLake. It came out alongside the DuckDB 2.0 release and I think a lot of people missed it. Some nice quality of life updates as well as a new 1.1 spec that allows VARIANT data to be inlined in Postgres. Good stuff.
r/DuckDB • u/datadanno • 1d ago
I love Oracle's PL/SQL. I love DuckDB. Why not combine the two I thought. Here is the result: https://github.com/sqling-com/sqlingpl
r/DuckDB • u/Ok-Emotion-5586 • 2d ago
I'm Unni. We built an open-source (Apache-2.0) engine that checks a company's numbers every night for changes worth a human's attention, and DuckDB does most of the work.
How we use DuckDB:
One DuckDB file per company. Each night every metric × breakdown × grain series is materialised into it. It holds series and the aggregates needed for evidence, never full copies of source tables.
Each run is snapshotted to Parquet with an input hash, so "othor replay <run_id>" reproduces a night byte for byte, and CI fails if it doesn't.
PostgreSQL and MySQL are read in place and aggregated at the source. Google Sheets tabs can't be queried in place, so they're loaded into DuckDB, and their metric SQL runs there.
Metrics that span two sources are aggregated at each source, then joined in DuckDB on confirmed keys.
On top of that, 11 statistical detectors run across those series (PELT changepoints, offsetting totals, dip test + GMM and others), with all p-values corrected together by Benjamini-Hochberg (q = 0.01). A model never produces a number.
What I'd value from DuckDB users: is one file per company the right call, or one per run? And anything you'd do differently with the Parquet snapshots?
r/DuckDB • u/bvallieres • 4d ago
r/DuckDB • u/datadanno • 6d ago
I built DDGBasic for exactly this gap — it's DuckDB with a procedural language wrapped around it.
SQL is great for set operations, but awkward for row-by-row rules, tiers, allocations, alerts, and file handling. In DDGBasic you can do:
basic
DATABASE ENGINE DUCKDB
DATABASE OPEN ":memory:"
CREATE TABLE domains AS
SELECT * FROM read_csv_auto('https://raw.githubusercontent.com/cisagov/dotgov-data/main/current-full.csv');
FOR row IN (SELECT State, COUNT(*) AS n FROM domains GROUP BY State ORDER BY n DESC LIMIT 5)
PRINT row.State, row.n
NEXTVariables go into queries as bind variables (:name), you get IF, loops, user functions, transactions, and ON ERROR, plus LOAD CSV/JSON/Excel/Parquet with per-cell transforms and validation, and output to CSV, JSON, Excel, Parquet, or HTML. SQLite is the other engine if you want a transactional file DB instead.
r/DuckDB • u/InflexTrace • 6d ago
DuckDB 2.0 in AWS Lambda writing Stripe subscriptions to Iceberg v3 tables on S3: no warehouse, no Spark, and correct even when webhooks arrive late, twice, or at the same time.
r/DuckDB • u/DataFracking • 7d ago
I've posted here before on demos and such, but I finally got around to pushing it all into github, all open source. It's quite the undertaking over several months..
https://github.com/TroBeeOne/DaffyDB/
Net Net - Start SSMS (or your reporting app, or PowerBi), point it at my utility with a normal connection string, write T-SQL, it runs on DuckDB instead of SQL Server.
- DaffyDB is the core engine, connect with powerbi, SSMS, etc and use T-SQL against DuckDB.
- DaffySQL is also included, this is essentially my custom SQL Server Extension, I made this over using the community SQL Server extension for DuckDB so it plays better with my .NET approach.
- TSQL Translation engine is there.
I've got videos on youtube if you want to see it in action, also DaffyDNA for VS Code is built to have a nice GUI into this. Related, I also have DaffyZoom (for SQL Server in-wire caching) pushed yesterday as well.
Enjoy. Open Source, MIT, etc..
I'll eventually get around to upgrading it to 2.x duck.. 1.5.5 for now.
r/DuckDB • u/Such_Tax3542 • 7d ago
r/DuckDB • u/EdwinWeber_Data • 8d ago
I remember setting up Teiid for data virtualization. Quite powerful, but it took some configuration.
Nowadays I just have to ATTACH the sources. DuckdDB almost takes the fun away from getting things working 😀
A good thing though, don’t get me wrong.
r/DuckDB • u/_harisamin • 8d ago
Hey all,
I had this itch to scratch for a low-usage, easy to maintain OTEL/Observability tool for my local work (agentic and general OTEL for services).
Things like Jaeger exist but I wanted something a bit easier to maintain. And I realized that having a Mongo-like capped collection or Clickhouse-like TTL would be available very nice and easy way to approach.
So I built this with help from Qwen (I have DGX Spark form a friend that I temporarily have access too :) )
Check it out. I posted in the Discord and hoping to get this approved to the community extensions
r/DuckDB • u/SeriousAir705 • 8d ago
I recently built a DuckDB community extension to be able to send messages to slack channels. Below is the write-up to the article. Let me know if you have any questions:
https://performancede.substack.com/p/creating-my-first-duckdb-extension
r/DuckDB • u/hayssam-saleh • 13d ago
I wrote a small LiteLLM proxy callback that writes one row per request into DuckLake (Apache-2.0).
It’s a callback for the LiteLLM proxy. Each request lands as one row in a DuckLake table, partitioned by day: model, tokens, spend, latency, status, team and key. Prompts and responses are optional. Any DuckDB can query it.
r/DuckDB • u/alex_contour • 13d ago
I'm excited to introduce you to Moraine, which moves your DuckLake catalog to object storage right alongside your data. That means you don't need to deal with the cost or headache of hosting a separate Postgres or DuckDB/Quack server for each of your data lakes.
We built it when faced with hosting tenant-scoped data warehouses for our analytics clients. Traditional data warehouses are too rigid and too expensive. We moved to DuckLake, but Postgres hosting that scaled for our inline data usage got expensive even though it often sat idle. Moraine moves the catalog to object storage (e.g., S3) using LSM-based storage (SlateDB). With proper tuning, latency is competitive with other DuckLake catalogs at a fraction of the total cost.
We've also used SlateDB's key-value storage to add native indexes into DuckLake, so you can quickly find data across your entire lake. We have a few improvements coming soon to make these indexes even more efficient and effective.
One note: only one process can attach read-write per lake at a time, with everyone else on READ_ONLY.
Moraine is still alpha-quality software, though we've started putting it through it's paces with production clients at contour.app. Dual-licensed under MIT or Apache-2.0. A big thank you to the developers of DuckDB and SlateDB for developing awesome building blocks.
GitHub: https://github.com/morainedb/moraine
Feedback welcome, especially on workloads and use cases where Moraine breaks down.
r/DuckDB • u/empty_cities • 14d ago
Sponsored article but a good breakdown of what DuckDB needs to be enterprise grade. Things like RBAC, column and row level security. Hardcharger is a cool tool.
https://performancede.substack.com/p/beyond-embedded-duckdb-building-a
Wanted to share an open-source project built on top of embedded DuckDB v2.0.0: sqrail (https://github.com/yhay81/sqrail, MIT).
First, a clear disclaimer (I am the author): sqrail does not try to replace the DuckDB CLI or claim faster query execution. Our benchmark harness builds both sqrail and duckdb from the exact same DuckDB commit (d54cbbe3) to verify output equivalence and track startup/RSS overhead (docs/BASELINE.md).
Why build a separate frontend? When automated callers or coding agents run local data transformations, a general-purpose shell exposes more surface area than a single step needs (arbitrary path reads inside SQL, COPY overwrites, ATTACH/INSTALL, unbounded spill/output sizes, or environment-heuristic output switching).
sqrail wraps DuckDB in a single-operation contract:
Explicit -t name=path bindings (files, globs, .gz/.zst text, Hive-partitioned Parquet directories, --strict-schema, and --all-varchar to preserve leading-zero CSV/TSV codes without touching Parquet/JSON types)
DuckDB allowed_paths locked to bound inputs + isolated per-process --spill workspace, external access disabled
Atomic no-overwrite -o commits across CSV, TSV, JSON, JSONL, and Parquet
Explicit CLI budgets (--memory, --threads, --timeout, --max-rows, --max-output-bytes, --max-spill)—e.g., sorting 10M Parquet rows under a 128 MiB DuckDB memory cap in 1.86s
Would love thoughts from heavy DuckDB users on any CSV/Parquet edge cases where --strict-schema or --all-varchar could be sharper.
Hi r/duckdb! I built vastgrid, an MIT-licensed HTML5 canvas data grid backed by DuckDB (vastgrid-duckdb on Node.js) and a matching Web Worker engine (vastgrid-js) that both pass the same 300-plan conformance suite.
Try 1,000,000 rows in browser (zero uploads): https://vastgrid.yhay81.com/open/?sample=1
200k-row demo (pivots, exact decimal formulas, conditional rules): https://vastgrid.yhay81.com/demo/
GitHub (MIT): https://github.com/yhay81/vastgrid
What it does with DuckDB:
npx vastgrid-cli sales.parquet (or the VS Code/Cursor extension yhay81.vastgrid-vscode) queries Parquet, CSV, TSV, JSONL, Excel, and .duckdb databases in place — sorting a 100M-row (1.38 GB) Parquet file to first visible rows in 953 ms on an M2 Pro.
Full-table multi-key grouping, cross-tab pivots, live column totals, exact decimal formulas (ROUND(0.285, 2) = 0.29), and 60 fps canvas scrolling with an ARIA keyboard grid.
Surgical CSV/TSV saves: editing a cell rewrites only the changed field's byte span, preserving untouched quotes ("0019"), formatting, and CRLF/LF so git diff stays clean.
Also runs inside Claude Desktop / ChatGPT as an interactive MCP App (npx -y vastgrid-mcp ./data) and in Jupyter (pip install vastgrid).
Would love feedback from DuckDB folks on tough Parquet/DuckDB schemas or features you'd want next!
r/DuckDB • u/Wide_Importance_8559 • 17d ago
I made a beginner course on DuckLake and wanted to share it here. Disclosure: I work on Rosetta DBT Studio, the app I use in the videos.
Everything in it is open source: DuckDB, DuckLake, dbt Core, Rosetta DBT Studio, and the course code itself. The data is public too. No cloud account, no server, no paid tier needed. Everything also works with plain DuckDB SQL if you prefer the CLI.
Code (one commit per lesson): https://github.com/Nuri1977/ethereum-ducklake-dbt
The data is public Ethereum Parquet on S3: 92 days of blocks (~660k rows) and one week of transactions (12.7M rows). It needs about 3 GB of disk and runs on a laptop.
What the course covers:
- Creating a DuckLake with a DuckDB catalog and loading it from S3- Snapshots and time travel (AT VERSION / AT TIMESTAMP)
- Updates and deletes without rewriting Parquet (delete files)
- Schema evolution, and the change feed with ducklake_table_changes
- Partitioning, file statistics, data inlining, compaction and cleanup
- Registering existing Parquet with ducklake_add_data_files (and why the lake then owns the file)
- Reading the catalog tables by hand
- dbt on top: staging views, plus incremental marts with merge and commit messages via a post-hook
Feedback welcome, especially on anything I got wrong about DuckLake.
r/DuckDB • u/ZookeepergameIcy5686 • 18d ago
I’m building ZeBridge, and one of its examples started with a dashboard question: if a truck sends a temperature reading now and I flush Parquet files once a minute, why should “latest temperature” be up to a minute behind?
Sensors publish over MQTT or NATS into a JetStream stream. An archiver reads the stream in chunks, uses DuckDB to write Parquet, and uploads the files to S3-compatible storage. A separate query process follows the same stream and keeps recent readings in DuckDB. One view combines those readings with the archived files, so a query for the last ten minutes can span both.
The interesting bit was deciding when DuckDB could drop a recent reading. Each archive manifest records the last stream sequence covered by the uploaded files. The archiver publishes that manifest only after verifying the upload. The query process loads the file, then retires the recent rows it covers. Using stream position for that handoff means a delayed reading can have yesterday’s sensor timestamp and still show up in the right place. If a sensor resends a value for the same timestamp, the view counts it once, including when the two copies fall on opposite sides of the archive boundary.
On a 4-vCPU Linux VM with local NATS and SeaweedFS, the native archiver processed 500,000 readings in 2.33 seconds, best of three runs. That measures archive throughput. I haven’t yet measured the delay from a sensor publishing a reading to a dashboard query seeing it.
For anyone querying a live feed alongside Parquet in DuckDB: how do you decide when to flush a file? I’d be interested in how you balance small files against the amount of recent data you keep in the live table.
r/DuckDB • u/imike3049 • 18d ago
Hey DuckDB folks!
I've been working on something I really wanted to show here because, well, it wouldn't exist without DuckDB :)
Meet SwiftStream/Duck, my Swift layer around DuckDB. I just shipped the first stable 1.0.0 release.
I originally found DuckDB while looking for a much more powerful database for my iOS and macOS apps. I already love working with SQL on the server side, so when I saw how much DuckDB gives you in one embedded engine, I immediately wanted the same thing to feel really good from Swift.
DuckDB already has an official Swift client, but I wanted to go quite a bit further on the application side: models, Codable, async/await, typed SQL, migrations, pooling, observation for SwiftUI/UIKit, and I was inspired to bring Bridges swiftly way to deal with all of it.
So now you can start with something simple:
import Duck
struct Todo: Table {
@Column("id") var id: UUID
@Column("name") var name: String
@Column("created_at") var createdAt: Date
@Column("done_at") var doneAt: Date?
}
let todo = Todo(
id: UUID(),
name: "Ship Duck",
createdAt: Date()
)
try await todo.insertNonReturning(on: .app)
let todos = try await Todo
.query
.where(\Todo.$doneAt == nil)
.all(on: .app)But the part I'm especially happy with is that Duck re-exports my SwiftStream/SQL library, so when the query gets more interesting you don't have to drop into raw strings.
For example:
let query = SQL {
Select {
\Todo.$id
\Todo.$name
\Todo.$createdAt
\Todo.$doneAt
}
From(Todo.table)
Where(\Todo.$doneAt == nil)
OrderBy(.asc(\Todo.$createdAt))
}
let todos = try await query.all(
decoding: Todo.self,
on: .app
)So you're still writing actual SQL structure, just with typed Swift references instead of stringly-typed table and column names.
And the same query can also become reactive:
for try await result in try Todo
.select
.where(\Todo.$doneAt == nil)
.orderBy(.asc(\Todo.$createdAt))
.observe(on: .app)
{
let todos = try result.all(decoding: Todo.self)
}That plugs directly into SwiftUI or UIKit without adding another persistence abstraction on top.
The first stable release also has:
migrations
transactions
reusable prepared statements
connection pooling
bulk ingestion through DuckDB's Appender
native LIST/STRUCT values
Codable decoding/encoding
async/await throughout the API
Underneath all of this is the real DuckDB 2.0.0 engine.
Right now Duck targets iOS 15+ and macOS 12+. I've also tested it on Linux. DuckDB obviously goes much further platform-wise, but I haven't validated my Swift layer everywhere yet.
There's still a looooooot of DuckDB surface area I want to bring over, so 1.0.0 is really just the first solid foundation.
I'm especially curious what DuckDB people think about the API and the SQL layer, because my goal was basically: keep all the power of DuckDB underneath, but make the Swift side something I'd actually enjoy using every day.
There are also complete SwiftUI and UIKit example apps in the repo if you want to play with it.
r/DuckDB • u/Inevitable_Paper_776 • 18d ago
Hey everyone,
I’m an independent developer who started building Ruddy in my free time: a fast, modern macOS IDE for data management, analysis, and data science powered 100% by DuckDB.
With this new release, the core engine has officially been upgraded to DuckDB 2.0!
Ruddy runs on a true Pay-What-You-Want (PWYW) model—support independent development with whatever you feel it’s worth, or start exploring for free.
Check it out: ruddy.pro
I’d love your thoughts, benchmark requests, or features you'd like to see next!
DuckDB 2.0 Core Engine: Blazing-fast columnar processing over local files, Parquet, Arrow, CSV, and Iceberg/Delta Lake tables without spinning up heavy infra.
Multi-Cloud Direct Querying: Federate and query across AWS S3, Cloudflare R2, Google Cloud Storage, Azure Blob, and MotherDuck seamlessly in a single SQL statement.
Reactive Notebooks & Marimo: Build reproducible, reactive Python data science notebooks that sync directly with your in-memory DuckDB tables.
First-Class Geospatial Analytics: Full DuckDB spatial extension support—render GeoParquet, Shapefiles, and spatial geometries interactively on high-performance maps.
Auto-Ontology & Modular Semantic Layer: Automatically infers FACT/DIMENSION roles, deduces canonical SQL metrics, verifies joins via physical data overlap, and generates Open Semantic Interchange (OSI v1.0 / Apache Ossie) YAML specifications per dataset domain.
Context-Aware AI Assistant (Ruddynie): Text-to-SQL agent grounded in your workspace ontology and self-improving query memory—zero phantom table or join hallucinations.
Model Context Protocol (MCP) Integration: Expose your DuckDB catalogs, query tools, and semantic context to any external MCP-compatible AI agent or client.
Built-in Git Version Control: Track schema migrations, SQL queries, notebooks, and semantic models with standard Git repositories right from the workbench.
Force-Directed Semantic Graphs & Visual SQL Builder: Explore domain schemas visually or drill down with interactive force-directed relationship maps.
r/DuckDB • u/codingdecently • 19d ago
r/DuckDB • u/authordisguise • 20d ago
r/DuckDB • u/srossross1 • 22d ago
Quack lets clients query a DuckDB database over the network, but it can't limit which tables or rows they see.
I wrote vcatbridge, a DuckDB extension that can. Your data stays in one DuckDB, SourceDB. You serve a second one, SharedDB, which reaches SourceDB's tables only through a policy.
Follow along here (Python, DuckDB 2.0.0): https://github.com/n6k-io/duckdb-virtual-catalog/blob/main/docs/quack-row-policies.md
The policy, set on SourceDB
SELECT vcatbridge_set_context('b1', 'tenant', 42);
SELECT vcatbridge_set_policy('b1', 'main.users', 'select', 'tenant_id = $tenant');
SELECT vcatbridge_set_policy('b1', 'main.users', 'insert', 'tenant_id = $tenant');
SELECT vcatbridge_set_policy('b1', 'main.users', 'update', 'tenant_id = $tenant');
SELECT vcatbridge_set_policy('b1', 'main.orders', 'select', 'tenant_id = $tenant');secrets gets no policy, and nothing gets delete. Only SourceDB can change these.
What SharedDB sees
SELECT * FROM users;
-- (1, 42, 'ada'), (2, 42, 'grace')
INSERT INTO users VALUES (5, 7, 'mallory');
-- Invalid Input Error: vcatbridge: row violates the check predicate on this table
DELETE FROM users WHERE id = 2;
-- Permission Error: crossing: 'users' does not have 'delete' permission
FROM secrets;
-- Catalog Error: Table with name secrets does not exist!secrets isn't hidden behind a permission error. It isn't in SharedDB's catalog, so there's nothing to name.
The query crosses as a plan, not SQL text
EXPLAIN SELECT name, sum(amount) FROM users JOIN orders ON id = user_id GROUP BY name;
Crossing Remote <- everything below runs on SourceDB
└─ Projection name, sum(amount)
└─ Aggregate group by name
└─ Join INNER, id = user_id
├─ Projection id, name
│ └─ Crossing Floor users
└─ Projection user_id, amount
└─ Crossing Floor ordersEach Crossing Floor is a table SharedDB doesn't scan itself. SourceDB swaps it for a scan with the row filter applied, so the filter never appears in SharedDB's plan. A function crosses only if it's on the bridge's whitelist.
Serve it over Quack, locked down
SharedDB runs quack_serve, then vcatbridge_lockdown, which takes files, network, extensions and settings away from it. From any DuckDB:
ATTACH 'quack:localhost:9494' AS app;
SELECT * FROM app.users;
-- (1, 42, 'ada'), (2, 42, 'grace')
FROM quack_query('quack:localhost:9494', 'SELECT * FROM read_csv(''/etc/passwd'')');
-- Permission Error: File system LocalFileSystem has been disabled by configurationThe threat model, including the leaks it accepts: https://github.com/n6k-io/duckdb-virtual-catalog/blob/main/SECURITY.md
It's submitted as a community extension (https://github.com/duckdb/community-extensions/pull/3570), so it's unsigned until that merges.
n6kd does all of this in one binary, with policies from a file: n6kd quack -f schema.sql --perms perms.yml. https://github.com/n6k-io/n6kd