r/DuckDB • u/datadanno • 8h ago
Row by Row Processing in DuckDB
2
Upvotes
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.