-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Expected behavior
I expect that either dbt.queryTemplate setting should be applied when utilizing the Preview SQL Query command, or, the macro is resolved prior to pushing in the limit.
Actual behavior
The row limit just seems to get tacked on without any safety net. This causes issues when you're queries have a limit defined via macro.
In running a command that has a limit in a macro, power user will generate sql like so:
select 1
limit 1000
limit 500In this case the, limit 1000 is from the macro, and the limit 500 is from power user.
Steps To Reproduce
- Create a dbt macro called limit macro that includes a limit:
{% macro limit_macro(row_limit=1000) -%}
limit {{ row_limit }}
{% endmacro -%}- Create a dbt model with the following:
select 1
{{ limit_macro()}}- Run the dbt power user preview.
Log output/Screenshots
Generated SQL:
select 1
limit 1000
limit 500
Error Message:
{
"code": -1,
"message": "Database Error\n syntax error at or near \"limit\" in context \"1\n limit 1000\n \n \n limit\", at line 8, column 3",
"data": "\"Error: Database Error\\n syntax error at or near \\\"limit\\\" in context \\\"1\\n limit 1000\\n \\n \\n limit\\\", at line 8, column 3\\n\\tat _.queryResult (/Users/tanderson/.vscode/extensions/innoverio.vscode-dbt-power-user-0.58.15/dist/extension.js:291:116)\\n\\tat async QueryResultPanel.executeQuery (/Users/tanderson/.vscode/extensions/innoverio.vscode-dbt-power-user-0.58.15/dist/extension.js:51039:90)\""
}Operating System
MacOS Version 15.7.2 (24G325)
dbt version
1.10.15
dbt Adapter
redshift
dbt Power User version
0.58.15
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working