Creating views from canvas cells

Your canvas creations can effortlessly become views

For more complex data modeling or combining multiple databases, you can create Views directly from a canvas cell.

⚠️ You can only do this from catalog canvases.

From the catalog homepage click on New canvas.

Perform your data modelling within it using SQL cells. You generate views from single cells, but any upstream references are automatically included as dependencies.

Once you're satisfied with the results, select the cell that contains the data you want to use. Scroll down the right sidebar and click Export view.

This will generate a new view in the catalog editor, pre-filled with the fields from the selected cell. Click on Validate and commit to publish the new view.

Canvas cell view YAML

Just like auto-generated views the YAML file is entirely customizable and can be edited directly in the catalog YAML editor.

There is no generated header comment in views created from canvas cells. The name matches the cell name by default.

name: artist_with_top_track

The source query is identical to the query in the cell you generated the view from.

source:
  connection: 1Tt8NMfDeHL
  query: |-
    SELECT a.*, b.title as top_track 
    
    FROM spotify.spotify_artists AS a
    
    LEFT OUTER JOIN artist_top_track as b
    ON a.name=b.artist

Views generated from catalog canvas cells contain a url link to the canvas they were created in.

  url: https://count.co/canvas/tGN8cuczHaA?version=IM82ISM833m&object=flCHvy2mniX

If your cell references other cells in the canvas they will appear as dependencies. It is even possible to join data from multiple data connections in a single view.

  dependencies:
    - name: artist_top_track
      query: |-
        WITH subq AS (
          SELECT artist, title, sum(streams) as sum_streams,
          row_number() over(partition by artist order by sum(streams) desc) as rn
          FROM spotify.spotify_daily_tracks
          GROUP BY ALL
        )
        
        SELECT artist, title
        FROM subq
        WHERE rn=1
        ;
      connection: 1Tt8NMfDeHL

Views generated from catalog canvas cells define only the field names and datatypes. This is the minimum requirement for functionality and can be customized to include labels, descriptions, expressions, aggregates or timeframes.

fields:
  - name: artist_id
    type: string

By leveraging Views, you can structure your data efficiently, ensuring consistency and accessibility across your organization while maintaining full control over how data is organized and explored.

Last updated