Count
count.co
  • Getting Started
    • What is Count?
    • Count FAQ
    • Intro to your workspace
    • Example canvases
    • Getting started guides
      • Set up your workspace and projects
        • 1. Review workspace settings
        • 2. Create and organise your projects
      • Canvas orientation
      • Your first ad hoc analysis
        • 1. Examples and templates
        • 2. Build your first queries
        • 3. Create visuals
        • 4. Caching, local cells and scheduling
        • 5. Collaborating with a stakeholder
      • Your first report
        • 1. Examples and templates
        • 2. Filters and control cells
        • 3. Sharing your report
        • 4. Alerts
  • Connect your data
    • Database connection overview
      • Athena
      • Azure Synapse
      • BigQuery
      • Databricks
      • Microsoft SQL Server
      • MySQL
      • PostgreSQL
      • Redshift
      • Snowflake
    • Refresh database schema
    • Upload CSV files
    • dbt integration
      • ☁️dbt Cloud integration
      • 👩‍💻dbt Core integration
  • Import & Export
    • Import from other tools
      • Import Miro files
      • Import SQL files
      • Import Google Sheets
      • Import Jupyter notebooks
    • Export code and results
      • Export compiled SQL and Jinja-SQL
      • Export CSV files
      • Export images and PDF files
  • THE CANVAS
    • Navigating the canvas
      • Canvas tool bar
      • Data sidebar
      • Customizing the canvas
    • Canvas objects
      • Cells
      • Text and markdown
      • Shapes and tools
      • Sticky notes
      • Frames
      • Images
      • Embeds
      • Stamps
      • Grouping objects
      • Object order and alignment
      • Locking objects
      • Scaling objects
      • Shared styles
    • Overviews
    • Templates
    • Count AI
    • Alerts and subscriptions
      • Slack integration
    • Keyboard shortcuts
  • Querying data
    • Cells overview
      • Dynamic query compilation engine
    • SQL cells
      • Referencing other cells
      • Jinja templating
      • SQL formatting
    • Python cells
    • Visual and low-code cells
      • Calculations in visuals and low-code cells
      • Joins in visuals and low-code cells
    • Control cells
      • Single and multiple selects
      • Date controls
      • Text, number, and boolean controls
      • Custom control cells
    • Local DuckDB cells
      • DuckDB on the server
    • Query caching and scheduling
    • Manage queries and results
    • Troubleshooting
  • Visualizing data
    • Visualization overview
    • Templated visuals
    • Custom visuals
      • Marks
      • Facet
      • Subplots
      • Style
      • Filters
    • Formatting a visual
      • Axes
        • Secondary Axis
      • Colors and labels
      • Legends
      • Tooltips
    • Column summaries
    • Dynamic text
    • Every Visual Under the Sun
  • Presenting and Reporting
    • Reports and Slides
  • Count Metrics
    • Intro to Count Metrics
    • Build and edit a catalog
    • Views
      • Creating views
      • Customizing views
    • Datasets
      • Creating datasets
    • Save changes to the catalog
      • Catalog validation
      • Version control
    • Exposing catalogs to the workspace
    • Caching in Count Metrics
    • Using the catalog
      • Explore from cell
  • Sharing and Permissions
    • Real-time collaboration
    • Comments
    • Sharing permissions
    • Shared links
    • Embedding canvases
  • History and Versions
    • Version control
    • Duplicating and merging
    • Data snapshots
  • Settings and administration
    • Workspace settings
      • Workspace members
      • Groups
      • Tags
      • Billing
      • Single sign-on (SSO)
        • Okta
        • Entra ID
        • JumpCloud
        • Google
        • Generic OIDC
      • Brand
    • Connection settings
    • Project settings
    • User settings
    • Roles and permissions
  • Quick guides
    • Interactive control guides
      • Date ranges
      • Date groupings
      • Search
      • Select All
  • Resources
    • Join the Slack community
  • Blog
  • Security overview
  • Terms of use
  • Pricing FAQ
Powered by GitBook
On this page
  • 3 ways to insert a cell
  • SQL cells
  • Python cells
  • Cell FAQs
  1. Getting Started
  2. Getting started guides
  3. Your first ad hoc analysis

2. Build your first queries

Previous1. Examples and templatesNext3. Create visuals

Last updated 7 months ago

You've seen some examples, you've scoped out your project, and you're ready to get going. The first thing you'll want to do is get some data into the canvas. To do this you'll need to start adding .

On this page, we'll be looking at:

  • The 3 ways to add cells to your canvas

  • SQL cells

  • Python cells

3 ways to insert a cell

1. From the Data side bar

To add data directly from the side bar, drag or click "Add to canvas" when you hover over a table or column. You can add data either from your database (in the Tables pane), or from other cells (in the Cells pane).

If you add a table to your canvas, a cell will be created containing a simple SELECT statement.

If you add a column, a visual will be created containing a simple query to represent the distribution of the column.

2. From the tool bar

3. From another cell

One of the unique features of the Count canvas is the ability to reference other cells - effectively turning your analysis into a DAG of connected queries. Instead of building messy, complex queries across several tabs in a SQL IDE, visualizing your analysis as a DAG helps because:

  • You can debug a query easily by isolating each subquery or CTE

  • You can copy and paste parts of the DAG for fast iteration and testing

  • The logical steps are easier to follow compared to reading complex nested SQL

Select a cell and hover near one of the edges and a plus icon will appear. Click the plus icon to choose which type of cell to create:

SQL cells

  • Each SQL cell is analagous to a tab of a SQL IDE.

  • Count can execute any SQL SELECT statement.

  • Queries are sent directly to your database, and results are retrieved and shown in the canvas, so use the same syntax you would in your database or SQL IDE.

  • To run a query you can:

    • Click away from the cell

    • Click the Run cell button in the floating cell controls

  • Format the SQL in your cell using the Format SQL button in the Design bar

Editing cells

  • The cell name is the identifier used in code to refer to the cell - ensure that it is a helpful name!

  • You can also add a cell title to help others understand what the cell represents

Python cells

In Count you're not limited to SQL only! Combine SQL with Python to bring a world of opportunity to your analysis.

Cell FAQs

What SQL is really running when I reference another cell?

Under the hood, all referenced cells are turned into CTEs, added to the query in your cell, and sent to your database.

How can I see how long my queries take to run?

On the bottom left of each cell, you will see metadata including:

  • The number of rows, and columns

  • When the query was last executed

  • How long it took to execute the query and download the results

I have some long-running queries, can I stop them from running?

You can also cancel all pending queries that are currently running:

Can I import existing queries?

Once they are imported you can turn any CTEs into cells in one click, instantly turning your query into a DAG of cells.

Select the type of cell you want from the , and then add the cell to the canvas.

Use the Shift + Enter

To learn more about using python in the canvas, see our docs .

To see the SQL that's being run, you can right-click on a cell and click .

Yes! You can turn on for your canvas and that will ensure that queries are only executed when a cell changes. You can also disable for the entire canvas, or an individual cell.

Yep! You can any query consisting of SELECT statements, including compiled .

tool bar
keyboard shortcut
here
Copy Compiled SQL
caching
automatic cell execution
import
dbt models
cells