Count docs

SQL cells

SQL cells are the analysis workhorse of Count

Creating a SQL cell

To create a SQL cell, click the 'cell' button in the menu bar, 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 data bar on the left hand side of the canvas.

Writing and formatting SQL

Count speaks the language of 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. You do not need to learn any new coding skills to use Count.
SQL cells have a few great features to make your work fast and easy:
  • Contextual auto-complete: Count will suggest table names, column names and functions depending on the scope of the SQL you are writing.
  • SQL linting: Accessed via the cell hover menu, Count will automatically format your SQL to be easy to read.
  • Automatic DAG creation: Count will automatically connect any SQL cells that reference one another with an arrow.
  • Automatic cell layout: Available by via the hover menu when you select multiple cells, Count will automatically arrange them in a logical manner.
  • Exploding cells: turn any query involving CTEs into a DAG of connected cells.

Exporting SQL from Count

Each cell, regardless of type, is a SQL statement under the hood. You can export that SQL via the right-click menu by choosing 'Copy compiled SQL.'
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.
Remember, each cell in Count is one or more compiled CTEs. Because we use the native SQL of your database, you can plug-and-play SQL from Count into your data source.