ref('customers') function if the project is deployed in the analytics schema of the prod database?select * from {{ ref('customers') }}
The ref() function in dbt returns the fully qualified name of the referenced model in the format database.schema.table. Since the project is deployed in the prod database and analytics schema, the correct output is "prod"."analytics"."customers".
orders and customers. Consider the following model SQL:select o.order_id, c.customer_name
from {{ ref('orders') }} o
join {{ ref('customers') }} c on o.customer_id = c.customer_idIf
orders has 100 rows and customers has 10 rows, and every order has a matching customer, how many rows will this query return?The join matches each order to exactly one customer. Since there are 100 orders and each has a matching customer, the result will have 100 rows.
select * from {{ ref(customers) }}Note:
customers is not in quotes.The ref() function requires a string argument. Without quotes, customers is treated as a variable which is not defined, causing a compilation error.
A uses {{ ref('B') }} and model B uses {{ ref('C') }}, which models will be built before A?dbt builds models in dependency order. Since A depends on B, and B depends on C, both B and C must be built before A.
sales, customers, and regions. The sales model uses {{ ref('customers') }}. You change the sales model to use {{ ref('regions') }} instead. What is the impact on the build order?Changing the ref() argument changes the dependency. Now sales depends on regions instead of customers, so it builds after regions.