Skip to main content

Tables

A Table in Sundial is the fundamental primitive for representing data in Sundial. It represents data organized in rows and columns, with a defined schema that specifies the name and data type of each column.

Each table has a unique name that identifies it within your workspace. It also has a schema defining the column names and data types. There may optionally also be table-level tests to validate data quality. And you can also track lineage showing upstream and downstream dependencies of any table.

There are two types of tables:

  • Sources tables, linked to source warehouses or data lakes
  • Views which are computed on-demand, during query time or as materialized views which are pre-computed and stored.

Together these can be used to define even the most complex business logic and data transformations in a consistent and standard manner. This flexibility allows you to optimize for both performance and storage costs while maintaining a consistent interface for working with your data.

Naming Tables

All tables have a unique name, which identifies the table. Table names can only contain alphanumeric characters and the underscore, and may not begin with a number. Examples of valid table names are user_orders, active_users_2023, revenue_by_month. Following sample names are invalid 2023_users, user-orders, revenue.by.month.

A good practice for naming tables is to name it based on 'what' data it represents and not 'how' it achieves it. For example, prefer active_users which clarifies business meanings over join_users_and_orders which describes the implementation.