Views
A View is the key building block of defining intermediate data transformations in Sundial. Successive views can be used to chain together transformations leading up to the final analytics-ready datasets Views allow reuse of your business logic by declaring important transformations in a single place, which can then be referenced in many subsequent views. This ensures that you can make changes in one place and have them reflect everywhere. For example:
- If you change how
active_usersis defined, all downstream views using it will automatically get the updated definition. - When you update revenue calculation logic in
daily_revenue, reports and dashboards using that view will show the new numbers. - If you modify user segmentation rules in a base view, all dependent views will inherit the new segments
Each View is defined by the SELECT query that defines the transformation by querying data from other Views or Sources.
- The expected schema (column names and data types) of the table that is inferred based on the SQL query.
- Materialization configuration, which (if set) defines how the view will be materialized.
- Table tests, to ensure that the data generated by the SQL is valid and matches expectations. These tests run whenever the view is refreshed.