AltimateAI / vscode-dbt-power-user

This extension makes vscode seamlessly work with dbt™: Auto-complete, preview, column lineage, AI docs generation, health checks, cost estimation etc
https://www.altimate.ai
MIT License
456 stars 89 forks source link

Query preview not working for ODBC driver #1456

Open tabit01 opened 1 week ago

tabit01 commented 1 week ago

Expected behavior

The preview feature should send a valid SQL query to my Fabric Synapse datawarehouse, using the ODBC Driver 18 for SQL Server. Running dbt, debugging, testing works as expected in the warehouse.

Actual behavior

The dispatched query is

select * from <table> limit 500

which is not valid T-SQL

Steps To Reproduce

In settings.json I first tried to set the query template:

"dbt.queryTemplate": "select top {limit} * from ({query}) as query"

I realized that the query template is deprecated, and set the field to blank, reinstalled extension, restarted VS Code etc.

Log output/Screenshots

Database Error
('42000', "[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near '500'. (102) (SQLExecDirectW)")

Operating System

Windows 11

dbt version

1.8.7

dbt Adapter

Fabric

dbt Power User version

0.47.0

Are you willing to submit PR?

pmags commented 6 days ago

Can confirm the same behaviour with dbt-sqlserver and ODBC Driver 17 for SQL Server. This started around Monday. Downgrading to a previous version didn't fix the issue either. Compile works though.

tabit01 commented 5 days ago

Probably relevant DBT Core issue?

https://github.com/dbt-labs/dbt-core/issues/10843

michrzan commented 4 days ago

I was able to make it work again by downgrading to: dbt-core 1.7.18 dbt-fabric 1.7.4 on Power User for dbt v0.47.0

pmags commented 1 day ago

I was able to make it work again by downgrading to: dbt-core 1.7.18 dbt-fabric 1.7.4 on Power User for dbt v0.47.0

I confirm that in my case it also solved the issue. I had tried downgrading but only the dbt-sqlserver library and not the core.

anandgupta42 commented 1 day ago

https://github.com/microsoft/dbt-fabric/issues/216

A fix has been pushed for this issue, but a new version has not been released.