SQL cells
SQL cells are the analysis workhorse of Count
Last updated
SQL cells are the analysis workhorse of Count
Last updated
To create a SQL cell, click the cell button in the , or hit the /
key. You can drop your cell anywhere on the canvas and start writing SQL. Your query can use any of the tables, columns or cells you see in the on the left hand side of the canvas.
Cells use the syntax for your database. For example, if you are querying Snowflake you should use Snowflake syntax and functions. If you switch to BigQuery, write in native BigQuery SQL.
SQL cells have a few great features:
Contextual auto-complete - Count will suggest table names, column names and functions depending on the scope of the SQL you are writing.
- Accessed via the design bar or right click menu, Count will automatically format your SQL to be easy to read.
- Count will automatically connect any SQL cells that reference one another with an arrow.
Automatic cell layout - Available with the keyboard shortcut Cmd/Ctrl+Opt/Alt+L
, Count will automatically selected cells in a logical manner.
Exploding cells - Turn any query involving CTEs into a DAG of connected cells.
- Use the jinja templating language to generate queries.
Each cell, regardless of type, is a SQL statement under the hood. You can export that SQL via the right-click menu by choosing .
It's important to understand that any given cell contains the SQL for all cells upstream in the DAG. This means you can export SQL from the last cell in a complex chain of analysis and export it to any database or data tool. This is often used for materializing views in a database.