Skip to content

Add blueprints to model_defaults #4928

@afzaljasani

Description

@afzaljasani

If we have a project where majority of our models need to use blueprints then it can get repetitive adding the blueprint config to each model. One example of this is let's say you have to build models in different data regions. You could have region as a blueprint variable and that could be utilized in the gateway parameter as well of a model config.

If a model doesn't need to utilize the model default then we could disable it by doing overriding it like this:

blueprints (
    @region: false
)

Example of model:

MODEL (
    name '@region.schema.table_name',
    blueprints (
        (region := us),
        (region := eu)
    ),

    gateway @regional_gateway(@region),
	name @model_name(@region, 'core_data', 'fct_events'),

	kind INCREMENTAL_BY_TIME_RANGE (,
        time_column event_timestamp,
        lookback 4
   
    )

SELECT
  column1,
  column2,
  event_timestamp
FROM `@{region}.events`
WHERE
  event_timestamp BETWEEN @start_dt AND @end_dt

Example of model defaults:

model_defaults:
  dialect: snowflake
  start: 2022-01-01
  blueprints:
   @region: ['us', 'eu']

Metadata

Metadata

Assignees

No one assigned

    Labels

    ImprovementImproves existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy