quoting

models/<filename>.yml
version: 2
sources:
- name: jaffle_shop
quoting:
database: true | false
schema: true | false
identifier: true | false
tables:
- name: orders
quoting:
database: true | false
schema: true | false
identifier: true | false

Definition

Optionally configure whether dbt should quote databases, schemas, and identifiers when resolving a {{ source() }} function to a direct relation reference.

This config can be specified for all tables in a source, or for a specific source table. Quoting configs defined for a specific source table override the quoting configs specified for the top-level source.

BigQuery Terminology

Note that for BigQuery quoting configuration, database and schema should be used here, though these configs will apply to project and dataset names respectively

Default

By default, dbt will not quote the database, schema, or identifier.

Example

models/<filename>.yml
version: 2
sources:
- name: jaffle_shop
database: raw
quoting:
database: true
schema: true
identifier: true
tables:
- name: orders
- name: customers
# This overrides the `jaffle_shop` quoting config
quoting:
identifier: false

In a downstream model:

models/<filename>.yml
select
...
-- this should be quoted
from {{ source('jaffle_shop', 'orders') }}
-- here, the identifier should be unquoted
left join {{ source('jaffle_shop', 'customers') }} using (order_id)

This will get compiled to:

select
...
-- this should be quoted
from "raw"."jaffle_shop"."orders"
-- here, the identifier should be unquoted
left join "raw"."jaffle_shop".customers using (order_id)