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

Execute dbt SQL fails if the query starts with a Jinga comment #1156

Closed
1 task
M4Al opened this issue May 23, 2024 · 2 comments
Closed
1 task

Execute dbt SQL fails if the query starts with a Jinga comment #1156

M4Al opened this issue May 23, 2024 · 2 comments
Labels
bug Something isn't working sweep

Comments

@M4Al
Copy link

M4Al commented May 23, 2024

Expected behavior

The query runner should ignore the Jinga comment and generate a valid SQL in the backend.

Actual behavior

Correct SQL generated

Steps To Reproduce

Take any dbt model and add a comment line as the first line

{# this is a base dimension, used to generate role playing ones#}
with final as (

    SELECT 
....

When using the Execute dbt SQL feature this query is generated:

    select *
        from (
            
with final as (

    SELECT 
...

when I remove the comment, the correct SQL is generated.

with final as (

    SELECT 
...

Log output/Screenshots

I presume the query execute feature checks if the query needs to be encapsukatedby checking if the first line/word is 'with' to detect a CTE.

This check either needs to be done after the Jinga template resolution or be more robust.

Operating System

Windows 11

dbt version

1.8.0

dbt Adapter

dbt-fabric-1.8.3

dbt Power User version

0.39.12

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@M4Al M4Al added the bug Something isn't working label May 23, 2024
Copy link
Contributor

sweep-ai bot commented May 23, 2024

Sweeping

0%

💎 Sweep Pro: You have unlimited Sweep issues

Actions

  • ↻ Restart Sweep

Step 1: 🔎 Searching

I'm searching for relevant snippets in your repository. If this is your first time using Sweep, I'm indexing your repository, which will take a few minutes.


Tip

To recreate the pull request, edit the issue title or description.

@mdesmet
Copy link
Contributor

mdesmet commented Sep 17, 2024

This is probably a bug in dbt-fabric. Please raise it there. We reuse the dbt show feature for query execution.

@mdesmet mdesmet closed this as completed Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sweep
Projects
None yet
3 participants