One question. One clear result.
Which region has the most sales? Run SQL against six fictional orders and produce three summary rows. North and West tie at 200; South has 150. You will use a Python notebook to run DuckDB SQL on your PC.
1. Get ready
Download KratosForge for Windows 10 or 11 (64-bit), then complete the installation and first-launch checks. Let the local engine finish preparing before starting. Follow any sign-in requirements shown by your build; the sample itself uses no Fabric data or capacity.
Timing: Installation, component setup and sign-in vary. This walkthrough has not yet been timed end to end in the desktop app, so a five-minute completion time is not promised. The instructions follow the development guides; controls in your Stable build may differ.
2. Open your starter
Download the starter notebook above. In KratosForge, use Ctrl+K → Open a notebook file, pick first-query.ipynb and confirm adding a copy. Select This PC as the run destination. Leave the notebook without an attached lakehouse; this sample does not need one.
If your build does not offer file opening, choose Create → Notebook (or New notebook on Home) and paste the code below into its empty Python cell. Both routes run the same example. See notebook files and your first notebook for the full workflow.
3. Run your first query
Select the code cell and press Shift+Enter. The six orders are embedded in the SQL, so there are no file paths to edit and no CSV import step. The downloadable CSV contains the same data for inspection; the SQL file contains the query on its own for reuse in DuckDB. For this walkthrough, run the notebook code below.
import duckdb
query = """
-- Fictional sales data, embedded so no file paths or cloud data are needed.
WITH sales(region, amount) AS (
VALUES ('North', 120), ('South', 90), ('West', 150),
('North', 80), ('South', 60), ('West', 50)
)
SELECT region, COUNT(*) AS orders, SUM(amount) AS total_sales
FROM sales
GROUP BY region
ORDER BY total_sales DESC, region ASC;
"""
with duckdb.connect(":memory:") as connection:
rows = connection.execute(query).fetchall()
print("region | orders | total_sales")
for region, orders, total in rows:
print(f"{region} | {orders} | {total}")
assert rows == [("North", 2, 200), ("West", 2, 200), ("South", 2, 150)]
print("First win: 6 orders, 550 total sales. Results verified!")
4. Match your result
| region | orders | total_sales |
|---|---|---|
| North | 2 | 200 |
| West | 2 | 200 |
| South | 2 | 150 |
The final line should say First win: 6 orders, 550 total sales. Results verified! The notebook checks all three rows automatically. A secondary alphabetical sort keeps North ahead of West when their totals tie. Amounts are fictional whole units, not currency estimates.
5. Make it yours
Change the first North amount from 120 to 150, then run again. North should now total 230, and all sales should total 580. The original assertion will fail because the expected data changed: update its first total from 200 to 230 and the final printed total from 550 to 580, then rerun. Restore 120 to reproduce the original result.
Need a hand?
- No output? Click the Python code cell and press Shift+Enter; wait for the local engine to become ready.
- DuckDB cannot be imported? Complete the app's component checks and see startup troubleshooting. This sample needs the local Python engine with DuckDB available.
- Assertion failed on the original sample? Restore the downloaded notebook or paste the original code again. It should return exactly the three rows above.
- Can't find a control? Check your release and the notebook guide; the website guides can describe development features ahead of Stable.
You have grouped six orders into three regional totals with SQL on your PC. Next, explore notebooks or the learning center. This example opens an in-memory DuckDB database and does not write to OneLake, publish an artifact or start a Fabric job.