vscode-dbt-power-user icon indicating copy to clipboard operation
vscode-dbt-power-user copied to clipboard

Query preview not working for ODBC driver

Open tabit01 opened this issue 1 year ago • 5 comments

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?

  • [ ] Yes I am willing to submit a PR!

tabit01 avatar Oct 09 '24 10:10 tabit01

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.

pmags avatar Oct 09 '24 23:10 pmags

Probably relevant DBT Core issue?

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

tabit01 avatar Oct 11 '24 12:10 tabit01

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

michrzan avatar Oct 11 '24 20:10 michrzan

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.

pmags avatar Oct 14 '24 18:10 pmags

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

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

anandgupta42 avatar Oct 15 '24 01:10 anandgupta42