CertSafari
    Snowflake SnowPro Advanced: Data Analyst (DAA-C01)· Lessons

    Domain 2 · Lesson 11/19

    Data modeling for BI in Snowflake: star schema, wide tables and Data Vault

    Use data modeling to manipulate the data to meet BI requirements.

    20 min read
    4.6% of exam
    6 sources
    Published 20 Oct 2026
    Docs as of 4 Oct 2026

    What you will be able to do

    • Arrange a fact table of measures and surrogate keys around shared dimension tables, and pick a single grain for it
    • Declare primary and foreign keys so BI tools and semantic views can infer joins, knowing Snowflake does not enforce them
    • Define metrics and bridge many-to-many relationships in a semantic view
    • Decide when a pre-flattened wide table beats a star schema for a dashboard, and what it costs
    • Say what hubs, links and satellites each hold, choose hash keys or natural keys, and expose a Data Vault to BI through information marts

    Key concept

    Model for the consumer — A BI model separates what is measured (facts) from the context it is measured in (dimensions), joined on keys, so every dashboard groups the same numbers by the same attributes. Whatever model sits underneath, staging tables or a Data Vault, the layer BI tools read has to be structured, typed and easy to join.

    1.Facts, dimensions and the star layout

    A star schema puts the events you measure in one place and the context you slice them by somewhere else. The fact table is narrow and long. Each row is a business event, such as a sales line item, and holds numeric measures plus a surrogate key for each dimension. The dimension tables are short and wide: product, store and date attributes, one row per member. Snowflake's TPC-DS sample data, which models a retail supplier's decision-support system, has exactly this shape. It has 7 fact tables and 17 dimensions, and they are joined on surrogate keys.

    The split pays off most when attributes are shared and change slowly. Several fact tables (store sales, catalog sales, web sales) can all join to the same product and date dimensions. A product's category then lives in one row, not on billions of fact rows. When a category is renamed you update that one row, and every fact table that joins to it sees the change. The fact table stays narrow, so a dashboard showing revenue by category, region and month scans the measure columns and joins to small dimension tables.

    Each fact table needs a single grain, meaning one row stands for one thing, such as one order line. Choosing the level of granularity (grain) covers how to pick it. In a model, the rule is that every measure in the table must be true at that grain. An order-level total stored on every line row gets summed once per line and inflates revenue. If you need it, put it in a fact table whose grain is the order, or compute it by aggregating the line facts upward.

    The alternatives fail the same dashboard in different ways. Copying every product, store and calendar attribute onto each sales row removes the joins, but it repeats shared attributes across billions of rows, and the table has to be rebuilt whenever one of them changes. Storing each sale as a VARIANT document and parsing it in every tile ignores the fact that most BI tools only read structured columns, and semi-structured content is slower to query. Pointing tiles at raw Data Vault satellites leaves the business user to do the integration work that a mart layer exists to do.

    Checkpoint 1 of 9· Check yourself

    A retailer has store, catalog and web sales tables with billions of rows. All three report by the same product category and calendar attributes, and those attributes rarely change. When a category is renamed, every dashboard must show the new name. Which consumption-layer design fits best?

    Checkpoint 2 of 9· Exam question

    A retail analyst must build Snowsight dashboards showing revenue by product category, store region and month from 2 billion sales line items. Category and region attributes change rarely and are shared by several other fact tables. Which design fits best?

    Sources123

    2.Declaring keys so tools can infer the joins

    Primary and foreign keys on a star schema are mainly there for the tools that read it. On standard Snowflake tables they are informational and not enforced. Declared vs enforced constraints covers that distinction in full. For modeling, the point is what declaring them gets you. Most BI and visualization tools import the foreign key definitions along with the tables and build the join conditions themselves. Nobody has to guess how SALES_FACT joins to PRODUCT, and different developers can't each wire the join their own way.

    The same metadata can make generated queries faster. Tableau uses constraints for join culling, also called join elimination. If a dashboard only needs fact columns, the tool can drop a join to a dimension it doesn't use. That is safe only when the declared keys are actually true.

    A dimension-style table with a primary key, and a fact-style table whose out-of-line foreign key references itsql
    CREATE OR REPLACE TABLE salespeople (
      sp_id INT NOT NULL UNIQUE,
      name VARCHAR DEFAULT NULL,
      region VARCHAR,
      constraint pk_sp_id PRIMARY KEY (sp_id)
    );
    CREATE OR REPLACE TABLE salesorders (
      order_id INT NOT NULL UNIQUE,
      quantity INT DEFAULT NULL,
      description VARCHAR,
      sp_id INT NOT NULL UNIQUE,
      constraint pk_order_id PRIMARY KEY (order_id),
      constraint fk_sp_id FOREIGN KEY (sp_id) REFERENCES salespeople(sp_id)
    );

    To check which keys a table declares before you point a BI tool at it, run SELECT GET_DDL('TABLE', 'mydb.public.salesorders');. The DDL it returns includes the constraints currently set on the table.

    Checkpoint 3 of 9· Fill the gap

    BI tools import one kind of constraint definition and use it to build the join from salesorders to salespeople on their own. Which keyword completes the constraint that declares this relationship?

    CREATE OR REPLACE TABLE salespeople (
      sp_id INT NOT NULL UNIQUE,
      name VARCHAR DEFAULT NULL,
      region VARCHAR,
      constraint pk_sp_id PRIMARY KEY (sp_id)
    );
    CREATE OR REPLACE TABLE salesorders (
      order_id INT NOT NULL UNIQUE,
      quantity INT DEFAULT NULL,
      description VARCHAR,
      sp_id INT NOT NULL UNIQUE,
      constraint pk_order_id PRIMARY KEY (order_id),
      constraint fk_sp_id  ?  KEY (sp_id) REFERENCES salespeople(sp_id)
    );

    Sources45

    3.Defining metrics once in a semantic view

    A star schema says how tables join. It does not say what "net revenue" means. A semantic view is a schema-level object that stores those business definitions in the database. It contains logical tables, which usually map to business entities, and relationships between them on shared keys. Inside the logical tables you define three kinds of element:

    • Facts: row-level values such as a sale amount. They can be aggregated up from a more detailed table, but they always appear as attributes of a single row of their logical table.
    • Dimensions: categorical attributes that answer who, what, where and when, used to filter and group.
    • Metrics: aggregations of facts across rows, such as SUM, AVG or COUNT. They are the KPIs on a dashboard.

    Defining a metric once removes the drift you get when every report writes its own formula. If net revenue always means gross revenue after discounts, the semantic view defines it once as SUM(gross_revenue * (1 - discount)) with the right aggregation. A request for net revenue by region then aggregates at the right level everywhere. In the TPC-H example below, orders.count_line_items is a fact defined as a COUNT over line items. It sits at the orders' grain, so averaging it per order gives a correct number.

    The METRICS clause of a CREATE SEMANTIC VIEW over TPC-H orders, customers and line itemssql
      METRICS (
        customers.customer_count AS COUNT(c_custkey)
          COMMENT = 'Count of number of customers',
        orders.order_average_value AS AVG(orders.o_totalprice)
          COMMENT = 'Average order value across all orders',
        orders.average_line_items_per_order AS AVG(orders.count_line_items)
          COMMENT = 'Average number of line items per order'
      )

    Relationships in a semantic view must be explicit, and they must be many-to-one. Cortex Agents won't join two tables unless the semantic view defines a relationship between them. Many-to-many relationships aren't supported directly. A product sold through many promotions, where each promotion covers many products, needs a bridge table between them. Two many-to-one relationships into the bridge give you the many-to-many behaviour. The same bridge pattern works in a physical star schema.

    Checkpoint 4 of 9· Check yourself

    Your team is building a semantic view over ACCOUNTS and CAMPAIGNS. Each account is targeted by many campaigns, and each campaign targets many accounts. Cortex Agents must be able to answer questions that combine the two. How should the relationship be modeled?

    Sources36

    4.When a flattened wide table beats the model

    A flattened data set does the joins and parsing once, at load time, so readers never pay for them. It wins when the reads are predictable and frequent and the data changes on a schedule. Take an executive dashboard that reads the same 12 columns from six joined tables, refreshes nightly and is opened by hundreds of people each morning. If join cost dominates the query time, a pre-joined table with just those columns, rebuilt after the nightly load, takes the joins out of every morning query. Turning the six tables into a Data Vault would add more tables to join, not fewer.

    Flattening has real costs. The pre-joined table is one more table to maintain, and it repeats dimension attributes on every row. The flattening step also adds latency to the load. Snowflake's Data Vault guidance warns that flattening nested content at ingestion delays loading the satellite table. Where the time from a business event to a dashboard matters most, it recommends leaving nested content unflattened in staging and letting the dashboard flatten it at query time.

    Three shapes for the layer a BI tool reads
    ShapeWins whenCosts
    Star schema (fact plus shared dimensions)Attributes are shared across fact tables, change over time, and queries varyJoins at query time; keys must be declared and kept correct
    Pre-flattened wide tableA fixed set of columns is read often and data refreshes in batchesRepeated attributes, another table to rebuild, added load latency
    VARIANT parsed at query time (LATERAL FLATTEN)Event-to-dashboard latency is critical and the schema keeps changingSlower queries; most BI tools need structured columns first

    When you're unsure, test with the real workload. Snowflake's table design guidance gives a concrete recipe for semi-structured data. Load a typical data set into a VARIANT column, use FLATTEN to extract the keys you plan to query into a separate table, run a typical set of queries against both, and keep the structure that performs best.

    Checkpoint 5 of 9· Match them up

    Three teams describe their workload. Match each consumption-layer shape to the workload where it is the better choice.

    Tap a term, then the definition that fits it.

    Checkpoint 6 of 9· Exam question

    An executive dashboard in Snowsight reads the same 12 columns from joins across six normalized tables. Data refreshes once each night, about 500 people open the dashboard each morning, and join cost dominates the query time. What should the analyst do?

    Sources42

    5.Data Vault: hubs, links and satellites

    Data Vault is a modeling style for the integration layer, the layer where data from many sources lands and is kept with full history for audit. It separates three kinds of content. Hubs hold business keys. When a key arrives from a source, it is first cleaned up (trimmed, upper-cased, defaulted) into a "treated" business key, and the hub stores that. Links record associations between hubs. They are designed for many-to-many relationships, but one link table can also hold one-to-one, one-to-many and optional relationships. Satellites hold the descriptive attributes and their history. Each satellite is the child of exactly one hub or one link.

    What each Data Vault table type holds
    Table typeHoldsKeyed by
    HubThe treated business keyHash key (or natural key) of that business key
    LinkAssociations between hubs, including many-to-manyHash keys of the hubs it relates
    SatelliteDescriptive attributes and their change history, plus dv_recsourceParent hub or link key plus dv_loaddate

    Satellites keep history by inserting rows, never by updating them. The standard satellite loader compares incoming content with the current record for the same parent key. It inserts a new row, stamped with its load date, only when something has changed. To make that comparison cheap, a satellite usually carries a record hash (a hashdiff) of its attributes.

    Keys can be either hashed or natural, but a vault must use one style throughout. Hash keys collapse a business key, plus any tenant ID and business-key collision code, into a single binary column. That gives every join one column. Natural keys skip the cost of hashing, but they have to be carried into every satellite so it can join to its hubs, which means joins on more columns. A vault that mixes the two forces every user to remember which tables use which style. Streams and tasks lower the cost of hashing by limiting each load to new data.

    Semi-structured and streaming payloads fit into satellites without redesign. The full original document goes into a dv_object metadata column of type VARIANT (VARIANT, OBJECT and ARRAY covers the type itself). New keys in the payload then don't force a table change. Critical elements, such as the business key, the event timestamp and the source event ID, are pulled out as typed columns in the same satellite. Those columns make queries faster and can improve pruning.

    Staging view for a clickstream satellite: raw VARIANT payload, treated business key, SHA1 hash key, load and applied dates, record sourcesql
    create or replace view staged.stg_casp_clickstream as
     select
     value as dv_object
     , coalesce(upper(to_char(trim(value:contid::varchar(50)))), '-1') as customer_id
     , value:contid::varchar(50) as contid
     , 'default' as dv_tenantid
     , 'default' as dv_bkeycolcode_hub_customer
     , sha1_binary(concat(dv_tenantid, '||', dv_bkeycolcode_hub_customer, '||', coalesce(upper(to_char(trim(customer_id))), '-1'))) as dv_hashkey_hub_customer
     , current_timestamp() as dv_loaddate
     , value:timestamp::timestamp as dv_applieddate
     , 'lake_bucket/landed/casp_clickstream.json' as dv_recsource
    
     , value:eventID::varchar(40) as eventID
     , value:eventName::varchar(50) as eventName
     from landed.casp_clickstream

    Checkpoint 7 of 9· Fill the gap

    The clickstream source keeps adding new keys to its JSON payload. The satellite must absorb them without any table change, and still pull the business key, event time and event ID out as typed columns. Which column name completes the line that keeps the full original document in this staging view?

    create or replace view staged.stg_casp_clickstream as
     select
     value as  ? 
     , coalesce(upper(to_char(trim(value:contid::varchar(50)))), '-1') as customer_id
     , value:contid::varchar(50) as contid
     , 'default' as dv_tenantid
     , 'default' as dv_bkeycolcode_hub_customer
     , sha1_binary(concat(dv_tenantid, '||', dv_bkeycolcode_hub_customer, '||', coalesce(upper(to_char(trim(customer_id))), '-1'))) as dv_hashkey_hub_customer
     , current_timestamp() as dv_loaddate
     , value:timestamp::timestamp as dv_applieddate
     , 'lake_bucket/landed/casp_clickstream.json' as dv_recsource
    
     , value:eventID::varchar(40) as eventID
     , value:eventName::varchar(50) as eventName
     from landed.casp_clickstream

    Checkpoint 8 of 9· Exam question

    In a Data Vault 2.0 model implemented in Snowflake, which table type stores the descriptive attributes of a business entity together with their change history?

    Sources42

    6.Serving a Data Vault to BI through information marts

    A raw vault is built for auditability, not for analysts. Its value lies in auditable history, business context and later batch analysis. A report, though, would need to join hubs, links and satellites and pick out the current satellite rows. BI users get a consumption layer instead: information marts, usually views shaped as facts and dimensions over the vault. New data loaded into the vault shows up in an information mart view immediately.

    For nested content there is a further step, the business vault. It holds derived tables that flatten out content such as nested arrays, so business users don't see the querying complexity. The trade-off is maintenance. Every business vault table is another table to manage and another table to join. That is why, for an overloaded source feed, fixing the problem at the source or in staging comes before fixing it in a business vault.

    Everything that makes a star schema easy to consume applies to these marts too. Declare keys on the mart tables so BI tools pick up the joins. Put metric definitions in a semantic view over the marts, which also hides the complex schema relationships from the people building reports. A team that integrates many changing source systems and must trace each value to its source and load time keeps the vault for that job, with dv_recsource and dv_loaddate on every row. Its analysts read the dimensional marts on top.

    Checkpoint 9 of 9· Check yourself

    Analysts at an insurer need dashboards built on a Data Vault that integrates a dozen changing policy and claims systems. The auditors still need every value traced to its source and load time. Newly loaded data should reach the dashboards with no extra rebuild step. What should the BI tools read?

    Sources32

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “consists of 7 fact tables and 17 dimensions”
      ↩︎ Facts, dimensions and the star layout
      “The relationships between facts and dimensions are represented through joins on surrogate keys.”
      ↩︎ Facts, dimensions and the star layout
      “The relationships between facts and dimensions are represented through joins on surrogate keys.”
      ↩︎ Key concept
    2. 2.
      “most BI tools can only process content in a structured format.”
      ↩︎ Facts, dimensions and the star layout
      “doing this at ingestion time causes a delay in loading the satellite table.”
      ↩︎ When a flattened wide table beats the model
      “If the business event to analytical value latency is critical, avoid flattening nested content in staging”
      ↩︎ When a flattened wide table beats the model
      “Semi-structured content is slower to query”
      ↩︎ When a flattened wide table beats the model
      “A satellite is either the child table of a hub or a link table.”
      ↩︎ Data Vault: hubs, links and satellites
      “link tables are designed to serve many-to-many/associative (M:M) cardinality”
      ↩︎ Data Vault: hubs, links and satellites
      “the treated business key is sent to the hub table”
      ↩︎ Data Vault: hubs, links and satellites
      “The standard loader checks if new content is different to the current record per parent key in the target satellite table.”
      ↩︎ Data Vault: hubs, links and satellites
      “queries running on this satellite will essentially need to use more columns to join on.”
      ↩︎ Data Vault: hubs, links and satellites
      “We can mitigate the cost of hashing by using Snowflake features such as Streams and Tasks”
      ↩︎ Data Vault: hubs, links and satellites
      “This new column will store the original semi-structured data as data type VARIANT.”
      ↩︎ Data Vault: hubs, links and satellites
      “The data is immediately available to the information mart view based on Data Vault”
      ↩︎ Serving a Data Vault to BI through information marts
      “The value in loading this data into Data Vault is the auditable history, business context, and the subsequent batch-oriented analysis”
      ↩︎ Serving a Data Vault to BI through information marts
      “use a business vault to flatten out the content so that you hide this querying complexity from the business end-user.”
      ↩︎ Serving a Data Vault to BI through information marts
      “This will result in the need to maintain and manage more tables and introduce more tables to join.”
      ↩︎ Serving a Data Vault to BI through information marts
      “A Data Vault should be produced as either natural-key or hash-key based and not a mix of the two.”
      ↩︎ Exam trap 3
      “but can also house explicit or mandatory (1:1 / 1:M) and optional (0..1:1..M) cardinalities within that same link table.”
      ↩︎ Exam trap 4
      “the target satellite table will also not need to have a record-hash (hashdiff) column”
      ↩︎ Prediction
      “The data is immediately available to the information mart view based on Data Vault, or it can be further processed into a business vault”
      ↩︎ Checkpoint
    3. 3.
      “they are always presented as attributes at the individual row level of the logical table”
      ↩︎ Facts, dimensions and the star layout
      “Metrics are quantifiable measures of business performance calculated by aggregating facts or other columns from the same table”
      ↩︎ Defining metrics once in a semantic view
      “provides consistent business definitions across enterprise applications.”
      ↩︎ Defining metrics once in a semantic view
      “simplifies complex schema relationships, making it easier to build and maintain data models.”
      ↩︎ Serving a Data Vault to BI through information marts
    4. 4.
      “most business intelligence (BI) and visualization tools import the foreign key definitions with the tables and build the proper join conditions.”
      ↩︎ Declaring keys so tools can infer the joins
      “The statement includes the constraints currently set on a table.”
      ↩︎ Declaring keys so tools can infer the joins
      “Run a typical set of queries against both tables to see which structure provides the best performance.”
      ↩︎ When a flattened wide table beats the model
      “Load the data set into a VARIANT column in a table.”
      ↩︎ Data Vault: hubs, links and satellites
      “referential integrity constraints, as defined by primary-key/foreign-key relationships, are informational; they are not enforced.”
      ↩︎ Exam trap 1
      “referential integrity constraints, as defined by primary-key/foreign-key relationships, are informational; they are not enforced.”
      ↩︎ Prediction
    5. 5.
      “Tableau supports using constraints to perform join culling (join elimination)”
      ↩︎ Declaring keys so tools can infer the joins
    6. 6.
      “Cortex Agents does not join tables unless the relationships are explicitly defined in the semantic view.”
      ↩︎ Defining metrics once in a semantic view
      “introduce a shared dimension (bridge) table so that two many-to-one relationships simulate the many-to-many behavior.”
      ↩︎ Exam trap 2
      “Many-to-many relationships are not directly supported. As a workaround, introduce a shared dimension (bridge) table so that two many-to-one relationships simulate the many-to-many behavior.”
      ↩︎ Checkpoint

    Spotted a mistake, or was something unclear? Tell us.