Skip to content

Multiple Sources

Validate that a model can depend on only a single source.

Source code in checkers/checks.py
def check_multiple_sources(model: Model):
    """
    Validate that a model can depend on only a single source.
    """

    assert (
        len(model.sources) <= 1
    ), f"Model can only depend on a single source, currently uses: {len(model.sources)}"

Reason to flag#

Model's should contain at most one source. This ensures that a single model is responsible for harmonizing a single soruce source table, eg for renaming and recasting fields.

Fixing#

Refactor the model to depend on a single source. This usually means creating 1 model per source, and having only that model reference the source. For example:

config(materialized='view')

select
  id,
  name
from {{ source('customer_data', 'names')}}

Parameters#

None