Comment on page

Cells overview

Cells are the building blocks of life and also your canvas.

What are cells?

Cells are how you query data in Count. While there are many types that look and function differently, under the hood every cell is a SQL select statement that returns a table.

Types of cells

Depending on how you want to build your query, you can choose one of the following cell types:
  • SQL cell - type SQL directly into the cell, using the syntax for your database or jinja.
  • Python cell - type Python code directly into the cell.
  • Visual cell- build pivot tables or charts without code by selecting columns from your database or other cells.
  • Control cell - provide input parameters for other cells via a widget. In other words, multi-select or calendar filters for example.
  • CSV cell - import CSV data into the canvas to use as a data source for other cells.

Where do cells get data?

Understanding how cells interact with your database and other cells is critical to getting the most out of Count. Any cell in Count can pull data from either your underlying database, or from another cell.
The implications of this are really quite powerful. For example, you could build a visualization directly against your database, then write SQL against your visualization. Any cell can be the starting point for a new analysis.

How do cells work?

Each cell is a query

Each cell is a query that is sent either to your database, the local database, or Python. Count's dynamic query compilation engine compiles SQL at runtime.

Cells reference and build upon one another

Because cells can reference a database or another cell, they can be chained together into a linear or branching analysis. This allows you to break complex problems into easier to solve chunks. Count automatically connects related cells to one another to make data flows easy to follow - this structure is called the DAG, and is indicated in the canvas with colored arrows between cells.

Cells are reactive

Any change in a cell will automatically flow through to all downstream cells. This makes updating your analysis a seamless process, and ensures that all cell results are kept in-sync with one another.

SQL cells are CTEs

Under the hood, each SQL cell is a common table expression (CTE). You can view this SQL at any time by right clicking the cell and choosing Copy compiled SQL. Because Count uses the syntax of your underlying database, you can port this SQL out of Count and into your database or dbt at any time.
Under the hood, each cell is an independent SQL query.
Count's dynamic query compilation engine makes all this goodness possible. Check it out in detail here.

Working with cells

Creating cells

There are four ways to create cells in the canvas:
  • Via the control bar at the bottom of the canvas, or via keyboard shortcuts.
  • Via the buttons that appear when you hover over the edge of any existing cell. This will create a new visual or SQL cell that is pre-configured to reference your starting cell.
  • Dragging a table from the data bar into the canvas to create a SQL cell.
  • Dragging a column from the data bar into the canvas to create a visual cell.

Naming cells

When you create a cell it will be given a default name. We strongly advise you to rename the cell to help remind yourself, and others, of what each cell represents. This is the name you will use to reference the cell in any SQL you write. And don't worry about changing a cell's name later. If you ever change a cell's name, you'll have the option to update the references in all downstream cells.

Cell hover menu

The cell hover menu contains options for viewing, formatting and exporting data from your cell. Click on a cell to select it and see the hover menu.

Cell context menu

The cell context menu contains additional cell-specific options for formatting, copying, selecting, and downloading data from cells. Right-click anywhere on the cell to open it.

Deleting cells

To delete a cell, simply select it and hit the backspace key.