Skip to main content

Defining a schema source property

models/<filename>.yml
version: 2

sources:
- name: <source_name>
database: <database_name>
schema: <schema_name>
tables:
- name: <table_name>
- ...

Definition

The schema name as stored in the database.

This parameter is useful if you want to use a source name that differs from the schema name.

BigQuery terminology

If you're using BigQuery, use the dataset name as the schema: property.

Default

By default, dbt will use the source's name: parameter as the schema name.

Examples

Use a simpler name for a source schema than the one in your database

models/<filename>.yml
version: 2

sources:
- name: jaffle_shop
schema: postgres_backend_public_schema
tables:
- name: orders

In a downstream model:

select * from {{ source('jaffle_shop', 'orders') }}

Will get compiled to:

select * from postgres_backend_public_schema.orders
0