We currently cannot mock CTEs which creates issues with dbt ephemeral models.
Being able to mock CTEs also allows us to create even more granular unit tests
What changed
Added functionality to mock CTEs
Take an example:
Now you can mock only cte_1 without the need of mocking some_table and another_table:
@table_meta(table_ref="cte_1")
class Cte1Mock(BaseTableMock):
pass
query = """
WITH cte_1 AS (
SELECT *
FROM some_table
LEFT JOIN another_table USING(id)
)
SELECT * FROM cte_1
"""
Problem Context
We currently cannot mock CTEs which creates issues with dbt ephemeral models. Being able to mock CTEs also allows us to create even more granular unit tests
What changed
Added functionality to mock CTEs
Take an example: Now you can mock only
cte_1
without the need of mockingsome_table
andanother_table
: