-
Notifications
You must be signed in to change notification settings - Fork 97
Description
Describe the bug
When previewing analyses, the LIMIT portion of dbt show is placed on the last line of the query. If the last line is an inline comment, the limit is appended to that comment and therefore not run as part of the executed SQL. Anecdotally, this causes the extension to become unstable when attempting to preview a large volume of rows.
When previewing models, the query is wrapped in select * from (...) limit 1000;, which avoids this issue.
What version of dbt Fusion is this bug in? (find out by running dbt --version)
LSP and CLI preview 120
Is this a discrepancy between the dbt Fusion Engine and dbt Core? Check one.
- YES
- NO
To Reproduce
-- analyses/example.sql
SELECT 1
-- comment- Preview above analysis using VSCE
- Observe placement of
limitin query to DWH:
-- logs/query_log.sql
-- created_at: 2026-02-27T23:51:54.958961500+00:00
-- finished_at: 2026-02-27T23:51:55.839004700+00:00
-- elapsed: 880ms
-- outcome: success
-- dialect: snowflake
-- node_id: not available
-- query_id: not available
-- desc: dbt run query
SELECT 1
-- comment limit 1000;
Expected behavior
LIMIT is added to the executed SQL such that it always executes as expected.
Screenshots
Operating System and CPU Type (please complete the following information):
- Windows x86