Help › Work in notebooks
Pivot, chart and filter a result without SQL
Add a pivot table, a chart or a filter of an earlier cell's result to a notebook, chosen from menus, and see the query Querlyn writes for it.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
A pivot table, chart or filter cell works on the result of a cell above it, the way a scratch cell does, but you choose what it does from menus instead of writing SQL. Querlyn writes the query and runs it in the scratch, on this computer.
Add one
Select the cell whose result you want to work on (or one below it), then choose Pivot, Chart, Filter in the notebook's toolbar, or:
- ()
- ()
- ()
The new cell works on the nearest result above it, chosen under Of, which lists the results of the cells above by name. When that result's cell has run, the new cell starts with a guess (the first text column and the sum of the first number column) that you change; until then, run that cell to choose among its columns.
A pivot table
- Rows: the columns its rows are grouped by. Add… groups by one more; the cross on a column takes it away.
- Columns: a column whose values become the table's columns, one per
value (
Jan,Feb, …), or None for one column per value below. - Values: what each group computes: a sum, a count of rows, a count of different values, an average, the smallest or the largest of a column. Value adds another.
A column with many different values makes as many columns: pivot on a column with few.
A chart
- Chart: bars, lines, areas, points or a pie.
- Along the bottom: the column of the categories or dates.
- Values: what is drawn for each, as in a pivot table, or Each value of a column to draw every row's value as it is (points).
- One series per: a column whose values each get a series of their own, or None.
The cell shows the chart of its result, as a query cell's chart does, and saves it in the notebook's file.
A filter
- Rows where: every condition holds, or any condition holds.
- Each condition is a column, a test and its value: is, is not, is less than, is at most, is more than, is at least, is between, contains, does not contain, starts with, ends with (these four whatever the case), is empty, has a value. Condition adds another.
- Columns: the columns it shows; with none checked, all.
- Order by a column, smallest or largest first.
- At most that many rows, or all.
A value for a column of numbers must be a number; for true or false columns, true or false. Text is compared as it is typed.
The query it stands for
Show SQL shows the query Querlyn writes from the settings, for DuckDB. Every name and value is quoted in it, never pasted in as it was typed: a value with a quote or a semicolon is compared as text. The query is written again with every change, and a cell whose settings are not complete says what is missing and runs nothing.
Edit as SQL () turns the cell into a scratch cell with that query, to change by hand. Its settings go.
How it runs
It runs as a scratch cell runs: the result it works on is copied into the
notebook's scratch tables first, in memory, with
masked columns copied empty;
it runs with Run All, Run Cell and Dependents, and is
out of date when the cell it works on
changes or runs again. Its own result has a name too, for what it is
(pivot, chart, filter, then filter_2…), so a later cell can work
on it: a chart of a filter's rows, for example.
In the file
The cell is saved as a query cell that holds the query, after a comment saying Querlyn wrote it, with its settings beside it in the notebook's metadata. Jupyter, VS Code and GitHub show the query and its saved result; Querlyn shows the settings again when the notebook opens.
Help for Querlyn 0.1.0. All help topics