You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The macros/models are executing the run_query function, but instead of querying the database, I would like run_query to query the mocked source defined in the unit tests.
Instead of doing this in the test:
overrides:
macros:
run_query:
rows:
- { id: 1 }
I want to mock the data directly in the ref model, such as ref('model_a'), and use it with run_query.
Example Model Code:
-- model_b.sql
run_query("select * from {{ ref('model_a') }}")
OR
-- models/model_b.sql
select * from database.schema.model_a_table
where id is not null
By defining the test inputs directly in the ref model, we avoid the need to override run_query using macros, providing a clearer and more maintainable testing strategy.
The text was updated successfully, but these errors were encountered:
The macros/models are executing the run_query function, but instead of querying the database, I would like run_query to query the mocked source defined in the unit tests.
Instead of doing this in the test:
I want to mock the data directly in the ref model, such as ref('model_a'), and use it with run_query.
Example Model Code:
OR
Example Unit Test:
By defining the test inputs directly in the ref model, we avoid the need to override run_query using macros, providing a clearer and more maintainable testing strategy.
The text was updated successfully, but these errors were encountered: