Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cte mocks #39

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Allow cte mocks #39

merged 1 commit into from
Jan 22, 2024

Conversation

Somtom
Copy link
Collaborator

@Somtom Somtom commented Jan 19, 2024

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 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
        """

@Somtom Somtom requested a review from mcnick January 19, 2024 16:18
@Somtom Somtom changed the base branch from main to v6-release January 19, 2024 16:19
@Somtom Somtom merged commit 4fbd039 into v6-release Jan 22, 2024
3 checks passed
@Somtom Somtom deleted the allow-cte-mocks branch January 22, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants