Creating views from database tables

Generate views from database tables with a single click

If your data is already well-structured, this is the quickest way to create a View. To get started:

Navigate to the catalog YAML editor by clicking Edit catalog on the catalog main page

Click the Generate files from tables button in the IDE's file directory.

Select tables from the available list, or search for one by name in the search bar. Once you have selected all the tables you want to generate views of, click on Generate files.

You will now be returned to the catalog YAML editor where you can see the newly generated views and datasets in the Views and Datasets sections. Click on Validate and commit to publish the new objects.

The view’s YAML file will be automatically populated with fields from the table, which you can then customize, remove, or edit as needed.

Auto-generated view YAML

The view YAML are entirely customizable and can be edited directly in the catalog YAML editor.

Each auto-generated view YAML file leads with a descriptive comment identifying the view as auto-generated and the name of the schema object it is generated from.

# Auto-generated by Count from table "spotify.spotify_artists"
name: spotify_artists
label: Spotify artists

Caching is set for duration 3600 seconds with no schedule by default.

caching:
  duration: 3600

Auto-generated views are a one-to-one extract of the underlying table. To add filters, joins or additional SQL logic such as case statements, edit the query in source

source:
  connection: 1Tt8NMfDeHL
  query: select * from spotify.spotify_artists

All fields will be given a user friendly label and, if it exists on the data connection schema, a description.

fields:
  - name: artist_id
    label: Artist id
    type: string
    primary_key: true
    description: |-
      "unique identifier for each artist"

Numeric fields have a predefined list of default aggregates

  - name: followers
    label: Followers
    aggregates:
      - sum
      - min
      - max
      - avg
      - null
    type: integer
    description: |-
      "number of followers on Spotify as of the updated_at column"

Date fields have a predefined list of default timeframes.

  - name: updated_at
    label: Updated at
    timeframes:
      - year_trunc
      - quarter_trunc
      - month_trunc
      - week_trunc
      - day_trunc
      - hour_trunc
      - day_of_week
      - null
    type: date
    description: |-
      "when the artist data was updated"

Last updated