Gallery · Polyglot

One report, four languages

SQL pulls orders out of SQLite, C# shapes the result, Python draws the chart, and Mermaid documents the flow. Four languages, one variable store, one page.

sales-report.verso C# · SQL · Python · Mermaid · 10 cells Read-only preview Download

One report, four languages

Every cell in this notebook works on the same data, and none of them copy it around. A SQL cell reads order data out of SQLite and publishes the result. A C# cell picks it up by name, shapes it, and leaves a few plain variables behind. A Python cell reads those variables as if Python had defined them and draws the chart. Verso's shared variable store is what makes that ordinary.

[1]
codeC#
1#r "nuget: Microsoft.Data.Sqlite, 8.0.8"
✓completed
Installed Packages
  • Microsoft.Data.Sqlite, 8.0.8
Transitive dependencies (6)
  • Microsoft.Data.Sqlite.Core, 8.0.8
  • SQLitePCLRaw.bundle_e_sqlite3, 2.1.6
  • SQLitePCLRaw.core, 2.1.6
  • SQLitePCLRaw.lib.e_sqlite3, 2.1.6
  • SQLitePCLRaw.provider.e_sqlite3, 2.1.6
  • System.Memory, 4.5.3
[2]
codeC#
1#!sql-connect --name orders --connection-string "Data Source=orders.db" --provider Microsoft.Data.Sqlite --default
✓completed
Connected 'orders' (default) using Microsoft.Data.Sqlite — database: main
  Connection string: Data Source=orders.db
[3]
sql
1SELECT ordered_on, region, product, quantity, unit_price
2FROM orders
3ORDER BY ordered_on
4LIMIT 6
✓completed
ordered_onregionproductquantityunit_price
2026-01-01EastArc Bookshelf4265
2026-01-01WestFountain Pen No. 4156
2026-01-01WestAurora Desk Lamp168
2026-01-01EastHalo Pendant Light4149
2026-01-02SouthAurora Desk Lamp168
2026-01-02WestSlate Writing Desk1420
[4]
sql
1--name regionalRevenue
2SELECT region AS Region,
3 COUNT(*) AS Orders,
4 CAST(SUM(quantity * unit_price) AS INT) AS Revenue
5FROM orders
6GROUP BY region
7ORDER BY Revenue DESC
✓completed
RegionOrdersRevenue
West400224388
East306147572
Central266105900
South22867781

From result set to variables

The --name directive on the query above published its result as regionalRevenue. To C#, that is just a DataTable waiting in the variable store.

[5]
codeC#
1using System.Data;
2
3var table = Variables.Get<DataTable>("regionalRevenue")!;
4
5var regions = new List<string>();
6var revenue = new List<double>();
7foreach (DataRow row in table.Rows)
8{
9 regions.Add((string)row["Region"]);
10 revenue.Add(Convert.ToDouble(row["Revenue"]));
11}
12
13var topRegion = regions[0];
14var topShare = revenue[0] / revenue.Sum();
15
16$"{topRegion} leads with {topShare:P0} of first-half revenue."
✓completed
West leads with 41% of first-half revenue.
[6]
codePython
1import matplotlib.pyplot as plt
2
3# regions and revenue were left behind by the C# cell above
4labels = [str(r) for r in regions]
5values = [float(v) for v in revenue]
6
7fig, ax = plt.subplots(figsize=(7.2, 3.8))
8bars = ax.bar(labels, values, color="#0078d4")
9ax.bar_label(bars, fmt="${:,.0f}", padding=3)
10ax.set_title("Revenue by region, January to June 2026")
11ax.set_ylabel("Revenue")
12ax.spines[["top", "right"]].set_visible(False)
13plt.tight_layout()
14plt.show()
✓completed
[7]
mermaid
1graph LR
2 DB[("orders.db")] --> Q["SQL cell<br/>publishes regionalRevenue"]
3 Q --> CS["C# cell<br/>shapes and shares variables"]
4 CS --> PY["Python cell<br/>draws the chart"]
5 CS --> MD["Mermaid cell<br/>renders this diagram"]
6 MD --> TOP["Leading region: @topRegion"]
✓completed

Take it home

Download this notebook and orders.db from the gallery page, then open it in VS Code with the Verso extension or serve it in a browser with verso serve sales-report.verso. Swap the query, rerun, and the chart follows.

Run it yourself

Nothing on this page is executable; the outputs were baked in by a real run. Download the notebook and it runs anywhere Verso does: VS Code, the browser, or the terminal.

dotnet tool install --global Verso.Cli
verso serve sales-report.verso

This notebook reads orders.db; download it into the same folder as the notebook.

What this shows

SQL pulls orders out of SQLite, C# shapes the result, Python draws the chart, and Mermaid documents the flow. Four languages, one variable store, one page.

Every language in this notebook reads and writes the same variable store, so a value produced in one cell is simply there in the next, whatever the language.