Getting started

fonctionnel

Create a notebook, write and run your first SQL and Markdown cells, save it as a .sqllynb file, and open notebooks other people send you.

Building a SQLly notebook from nothing: a heading, a base query named orders, a second cell that reads it with {{orders}}, then an edit that marks the reader out of date until Run All.

Real recording · typing sped up · Northwind demo data

Open the walkthrough on its own page

This walkthrough builds a small notebook from nothing: a note, a base query, and a second query that reads the first one's result by name. It takes about five minutes and works on any database SQLly connects to.

Create a notebook

Pick whichever is closest to hand:

  • File ▸ New Notebook, ou Nouveau notebook in the command palette.
  • Turn the query you're already writing into one: right-click its tab and choose Open as Notebook (the whole script becomes one cell) or Open as Notebook, One Cell per Statement (one cell per statement, split the same way Run splits them, on ; et GO). Query ▸ Open Query as Notebook and the palette do the same. The new notebook keeps the tab's connection.
  • File ▸ Open Notebook… opens a .sqllynb file, an older .sqlnb.json notebook or a Jupyter .ipynb.
SQLly
SQLly File menu with New Notebook, Open Notebook and Save NotebookSQLly File menu with New Notebook, Open Notebook and Save Notebook
The File menu: New Notebook, Open Notebook… and Save Notebook sit with the other file commands.

A new notebook opens in its own tab (named "Notebook 1" until you give it a title) with one empty SQL cell. It uses the connection shown in the top bar, Connection: …; pick a different one there, or give single cells their own connection later.

Write your first cells

  1. Add a note. In the row of buttons under the last cell, click Markdown cell and type a heading such as # Orders by country. Click Terminé to see it rendered; double-click it to edit again. Headings show up in the Outline on the left.
  2. Write the base query in the SQL cell. Click into it to edit; the editor has the same IntelliSense as a query tab and grows with its content.
    SELECT o.OrderID, o.ShipCountry, o.Freight
    FROM dbo.Orders AS o
    WHERE o.OrderDate >= '1997-01-01'
  3. Name it. With the cell selected, type orders dans le Nom field of the inspector on the right. A name is what other cells use to read this one.
  4. Exécutez-le avec ⌘Retour (Ctrl+Entrée) or the play button in the top bar. The result grid opens under the cell, and its header changes from Not run en Up to date.
  5. Build on it. Cliquez SQL cell to add another, and read the first cell's result by putting its name in double curly braces:
    SELECT ShipCountry, COUNT(*) AS Orders, SUM(Freight) AS Freight
    FROM {{orders}}
    GROUP BY ShipCountry
    ORDER BY Freight DESC
    Run it. SQLly folds the orders query into this one as a common table expression, so the database runs one query and nothing is copied. See Named cells and references for how that works on each engine.
  6. Change the base query (say, the date) and look at the second cell: it now says Out of date, because the result it shows no longer matches the SQL it reads. Press Exécuter tout (⌘⇧Retour), or choose Run ▸ Run Stale Cells to run only what is out of date.

The add-cell row (and the + between cells) offers every kind of cell, from charts and KPI tiles to data checks and AI cells; Cells and cell types lists them. ⇧Return runs a cell and moves to the next one, and Échap switches to command mode, where single keys add, delete and convert cells; see the keyboard reference.

SQLly
A notebook with Markdown and SQL cells, the outline rail and the inspectorA notebook with Markdown and SQL cells, the outline rail and the inspector
A finished notebook: Markdown headings in the outline, named SQL cells that read each other, and the inspector showing the selected cell.

Save it

Appuyez sur Enregistrer in the top bar, File ▸ Save Notebook ou ⌘S and choose a name: notebooks save as .sqllynb files (More ▸ Save As picks a new name later). The file holds the cells and their settings, not the results, so it stays small and diffs cleanly; see File format and Git. A notebook opened from a Jupyter .ipynb keeps saving as .ipynb. One opened from an older .sqlnb.json file is saved as a new .sqllynb file rather than overwriting the old one.

  • Unsaved notebooks are not lost. Until you save, SQLly keeps a recovery copy, written as you edit, and reopens the notebook with your workspace after a restart or a crash. The top bar says Recovered when that happens. Closing the tab or saving it to a file removes the copy.
  • Autosave to a file is opt-in. Activer More ▸ Autosave to File to have a saved notebook write itself to its file as you edit.
  • Changes from elsewhere are noticed. If the file changes on disk while it's open (a git pull, a sync folder), the top bar shows Changed on disk avec Recharger et Keep mine, and nothing is overwritten until you choose: Save refuses with "… changed on disk. Choose Reload or Keep mine before saving." In the browser build the same guard covers a notebook changed in another tab.
  • A copy gets its own identity. If you copy a notebook file by hand, or keep working in the original after Enregistrer sous, the two files start out with the same notebook id. The file this computer already knew keeps its trust, run history and local data; the other one gets a new id the first time you save it, and SQLly tells you once: "This file is a copy of another notebook, so it now has its own identity: its trust, run history and local data are kept apart from the original's."
SQLly
Notebook top bar showing the Recovered save stateNotebook top bar showing the Recovered save state
An unsaved notebook restored from its recovery copy after a restart, marked Recovered in the top bar.

Open a notebook someone sent you

Opening a notebook never runs anything. A notebook you didn't create on this computer, or one whose SQL or connections were changed outside SQLly since you trusted it, opens behind a banner, and none of its cells run until you press Trust notebook and choose which connections it may use. Read its SQL first: everything is visible before you decide.

SQLly
Notebook trust banner with the Trust notebook buttonNotebook trust banner with the Trust notebook button
A notebook from another computer opens behind the trust banner: you can read every cell, but nothing runs until you trust it.

If the notebook names connections this computer doesn't have, SQLly asks you to map each one to a connection of yours. Both steps are covered in Connections and safety.

Before a notebook file opens, SQLly checks it for anything unsafe. A file that fails the check isn't opened at all ("This notebook was not opened because it may be unsafe: …"). Things worth knowing that don't block it, such as an image loaded from the web or a notebook that re-runs itself when its parameters change, show in a banner under the top bar that you can dismiss, and in the activity panel. See Security model.

SQLly
Notebook safety check banner listing two warningsNotebook safety check banner listing two warnings
A shared notebook opens with the safety check's warnings in a banner under the top bar, and in the activity panel.

Back to a plain script

Export ▸ Convert to SQL Script in the notebook's top bar (also Query ▸ Convert Notebook to SQL Script) opens the notebook as one SQL script in a new query tab: references are expanded into the SQL where they can be, and Markdown cells become -- comments. Other cell kinds, such as charts, are left out.

Where next