Skip to main content
Query views are views created from an underlying query. If initially created in a workbook, the query view must be promoted to the shared model before it can be used in other workbooks. This model file type has a file name structure of <query_name>.query.view. The file name is dynamic based on what the query tab is named in the workbook. Parameters in query views are automatically generated when you use the Model > Save query as view option in a workbook. Query views can also point to a SQL query. These use the sql parameter to define the query, eg.
sql_query_view.query.view
schema: PUBLIC
sql: |
  SELECT user_id, sum(sale_price) as total_sales
  FROM order_items
  GROUP BY 1
dimensions:
  user_id: {}
  total_sales: {}
  measures:
    count:
      aggregate_type: count