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

Test code reporting error when test code uses CTEs with line breaks after "with" keyword #560

Closed
CamronBorealis opened this issue Sep 17, 2024 · 1 comment · Fixed by #561

Comments

@CamronBorealis
Copy link

Steps to reproduce:

  1. Create test that uses CTEs with a line break after the "with" keyword
  2. Execute the test

Expected result:

  • Test should report pass or fail

Actual result:

  • Test reports an error

Sample test code reporting error:

with

failures as (
    select *
    from {{ model }}
    where {{ column_name }} is null
)

select *
from failures

Sample test code that reports pass/fail:

with failures as (
    select *
    from {{ model }}
    where {{ column_name }} is null
)

select *
from failures

Suspected root cause:

This regex expression assumes the code style includes the "with" keyword on the same line as the identifier of the CTE:

{% set with_statement_pattern = 'with .+ as\s*\(' %}

@cody-scott
Copy link
Collaborator

Good catch. I’m wondering if it’s better anyways to just create a view every time instead of this branching logic.

Will tackle this later today or tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants