AltimateAI / AltimateAI/vscode-dbt-power-user

Incorrect Compile Code from DBT Power User

Offen
#1,154 4 Kommentare 2 Reaktionen 1 zugewiesene Person Beansprucht von @mdesmet Auf GitHub ansehen
bug sweep
Vorherrschende Sprache
JavaScript
Sterne
585
Forks
121
Ø Merge
5 T. 39 Min.
Gemergte PRs (30 T.)
4

Beschreibung

### Expected behavior
While using the Complied DBT preview feature result is not as expected:
1. In my model, I'm using a macro for the incremental logic, which contains various if-else statements to determine the compiled code. However, it seems that part of the logic is being skipped, and I'm not sure why this is happening.

![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/94ea7d5d-bcda-48da-9f32-ca4d6f7dc54e)
![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/27bd482f-48c8-4713-b400-6a87c3ac2f8d)
![2024-05-21 20_31_45-dim_incremental_merge_by_pk sql - dmg-gcp-cdw-data-etl - Visual Studio Code](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/5e6c5a79-5c33-49c6-998d-e7563bddc4bd)

2. I compared the compiled code generated by DBT with the code generated by the plugin, and I noticed that several pieces of logic that should be present in the compiled code are missing.

![2024-05-21 19_31_32-srv_temp____temp__dim-appraisal_pps_t sql - dmg-gcp-cdw-data-etl - Visual Studio](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/297c6449-6fee-4838-b9d5-f530be8fffb8)

3. In my model, after implementing the incremental logic, I use another macro to apply the casting logic to ensure each column is cast to its appropriate type. However, this step is failing.

![2024-05-22 12_33_51-](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/5e570054-8246-470e-98bb-ca80b6b61710)

4. While executing the query, it's failing with the following error. My DBT architecture places all models under a folder called CDW. However, using dbt deps, we're downloading the project dependencies into a core folder, as specified in the packages.yml file.

{
"code": -1,
"message": "Database Error\n Syntax error: SELECT list must not be empty at [305:1]",
"data": "\"Error: Database Error\\n Syntax error: SELECT list must not be empty at [305:1]\\n\\tat DBTCoreProjectIntegration_1. (c:\\\\Users\\\\.vscode\\\\extensions\\\\innoverio.vscode-dbt-power-user-0.39.12\\\\dist\\\\extension.js:18398:127)\\n\\tat Generator.throw ()\\n\\tat rejected (c:\\\\Users\\\\.vscode\\\\extensions\\\\innoverio.vscode-dbt-power-user-0.39.12\\\\dist\\\\extension.js:25808:28)\""
}
![2024-05-22 12_38_24-](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/b8a8d161-845f-42b8-ac34-f2bbff9bea45)

![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/a5cabdfd-005f-495f-b94e-0f03212ca4e9)

### Actual behavior
After compiling the code
1. It should read the macro logic and based on that it should return the correct code.
2. Should apply the casting logic as mentioned the model using the specific Macro.
3. Query Result should return the value
### Steps To Reproduce
Using **poetry shell** to activate the poetry virtual env
Using python version 3.11.6
dbt-core 1.6.1
dbt-bigquery 1.6.4

Create any model having Macro for incremental logic using if-else where it'll check if the table exist then if condition else another condition
![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/a7197d37-2f9c-4fd8-83bf-f8aae3bb7b71)
![image](https://github.com/AltimateAI/vscode-dbt-power-user/assets/40270276/3d6791f3-5145-46f3-abf9-32741c5be90d)

### Log output/Screenshots
_No response_
### Operating System
Windows 10
### dbt version
1.6.1
### dbt Adapter
dbt-bigquery 1.6.4
### dbt Power User version
v0.39.12
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.