Install and load
Run these commands in a Haybarn SQL session. The extension is available from the community repository.
INSTALL anofox_scenario FROM community;
LOAD anofox_scenario FROM community;
Try it in a temporary SQL session with anofox_scenario already loaded. Queries run in this tab; examples using files or services need their own setup.
Using upstream DuckDB? Follow the maintainer’s installation instructions.
Usage example
History as recorded
-- History as recorded
CREATE TABLE sales_plan (region VARCHAR PRIMARY KEY, units INTEGER);
INSERT INTO sales_plan VALUES ('EMEA', 1000), ('AMER', 2000), ('APAC', 500);
-- Branch a what-if world: two statements, then it's just SQL
CALL scenario_create('aggressive_q4', 'push APAC hard');
ATTACH 'aggressive_q4' AS q4 (TYPE scenario);
UPDATE q4.sales_plan SET units = 1500 WHERE region = 'APAC';
DELETE FROM q4.sales_plan WHERE region = 'EMEA';
-- Both worlds coexist; the base is never written
SELECT 'base' AS world, * FROM sales_plan
UNION ALL
SELECT 'scenario', * FROM q4.sales_plan ORDER BY world, region;
-- Audit the changes, then promote them
SELECT * FROM scenario_diff('aggressive_q4', 'sales_plan');
SELECT * FROM scenario_merge('aggressive_q4');
Provided by DataZooDE. Not yet verified on Haybarn 2.0.0.
Sample data & setupAbout this extension
anofox_scenario brings git-like branching to DuckDB databases. A scenario is an attached catalog (ATTACH 'name' AS s (TYPE scenario)) over your existing tables: reads merge the base with the scenario's copy-on-write delta on the fly, and INSERT / UPDATE / DELETE / MERGE INTO / ON CONFLICT (all with RETURNING) land in the delta — the base tables are never modified.
Three isolation tiers: a live overlay (default), mode := 'materialized' point-in-time copies, and DuckLake bases pinned to creation time via AT (TIMESTAMP) for zero-copy snapshot isolation. Scenarios branch from each other (from_scenario :=), inheriting changes, declared row identities, and snapshot pins.
Project overview from the community descriptor.
Documentation and resources
Project and build details
- Repository
- DataZooDE/anofox-scenario
- License
- BSL 1.1
- Maintainers
- jrosskopf
- Written in
- C++
- Build source
1813667992e4- Build definition
- Community descriptor