Jupyter and older notebooks
功能的Open .ipynb notebooks from Jupyter, VS Code and Azure Data Studio, and older .sqlnb.json notebooks, and what carries over in each direction.
SQLly notebooks save as .sqllynb, but they open the other notebook files you're likely to have: Jupyter notebooks from JupyterLab, VS Code and Azure Data Studio, and notebooks saved by earlier versions of SQLly. File ▸ Open Notebook… takes all three; the file's content decides how it's read, not only its extension.
| 文件 | Opens as | Saves as |
|---|---|---|
.sqllynb | Itself. | .sqllynb |
.ipynb (Jupyter, VS Code, Azure Data Studio) | Code cells become SQL cells, Markdown and raw cells Markdown; outputs are dropped. | .ipynb, with SQLly's extras in the file's metadata |
.sqlnb.json (SQLly before notebooks v2) | Upgraded in memory: ids, names, references and parameters carried over. | 新的 .sqllynb file; the old file is left alone |
Jupyter and Azure Data Studio notebooks
Code cells become SQL cells, with a leading %%sql 或者 %sql magic removed. Markdown stays Markdown and raw cells become Markdown so their text isn't lost; collapsed cells stay collapsed. Stored outputs are not imported, because they came from someone else's connection at some other time. The connection an Azure Data Studio notebook was saved with doesn't come along: choose one in the top bar.
Every code cell becomes SQL, whatever language it was written in; SQLly has no Python or PowerShell runtime, so convert those cells to Markdown (M in command mode) or delete them. A notebook from another tool opens untrusted, like any notebook from elsewhere, so nothing runs until you trust it.
Saving as .ipynb writes nbformat 4.5 with a SQL kernel, which those tools open. Cell names, kinds, connection slots, policies, settings and parameters go into metadata.sqlly; chart, KPI, test, dashboard and other SQLly-only cells are written as raw cells with their settings there, and come back intact when SQLly opens the file again. Metadata other tools wrote (papermill parameters, Azure Data Studio cell ids, a notebook's own metadata) is kept and written back, and a raw cell that opened as Markdown is saved as a raw cell again. Full details: Jupyter 笔记本 和 Azure Data Studio 和 VS Code.
Notebooks from earlier SQLly versions
Earlier versions of SQLly saved notebooks as .sqlnb.json. Those open as they were:
- Cells keep their
cell_Nids and get that id as their name, so{{cell_2}}references keep working. Rename them in the inspector to something readable and the references follow. - Old
@nameparameters become text parameters, with the old value as the default. - SQL cells that change data keep working: they come in with writes allowed. New cells you add start read-only.
- Saving writes a new
.sqllynbfile, because older SQLly versions can't read the new format; your.sqlnb.jsonstays as it was.
An old notebook carries no notebook id, so until you save it as .sqllynb it gets a new id each time it opens, and opens untrusted each time. Save it once and trust it, and that sticks. Autosave never rewrites the .sqlnb.json file; only Save writes the new one.
Getting work out to other tools
- Export ▸ Export Jupyter writes an
.ipynbcopy; Export ▸ Export Markdown writes the notebook with its results as Markdown tables. - Export ▸ Convert to SQL Script opens one SQL script with references written out, for any tool that runs SQL.
- 导出… writes HTML, PDF, Excel, CSV, SVG and PNG reports; see Exporting and the fidelity report.