AltimateAI / AltimateAI/vscode-dbt-power-user

Wrong schema used for 'sync with the database' in documentation editor

Đang mở
#884 5 bình luận 1 reaction 1 người được giao Được @mdesmet nhận Xem trên GitHub
bug
Ngôn ngữ chính
JavaScript
Star
585
Fork
121
Merge trung bình
5 ngày 39 phút
Pull request đã merge (30 ngày)
4

Mô tả

### Expected behavior

When using 'sync with database' in the documentation editor, I expect it to use the same schema as it would be used during a dbt run executed by the extension.

### Actual behavior

Another schema is used, and since the table is not present there, no retrieval of metadata happens.

### Steps To Reproduce

In our profiles.yml, the schema is defined as an env variable:
`schema: "{{ env_var('DBT_DATASET_PREFIX') }}"`
We change this variable dynamically depending on which git branch is currently checked out in our project.
For the extension to work we added a custom dbt wrapper which does the following:
* Check active git branch in the project folder
* Set environment variable accordingly
* Call dbt command

With this setup dbt-power-user works well with the dynamic schema names, i.e. I can call the run button for a model and it will be deployed in the correct schema depending on the current git branch.

For the sync with DB in the documentation editor this does not work.
We observed that it always tries to sync using the 'default' schema, i.e. the one as if the environment variable was not changed from its default value.
One way how I could imagine this to happen is, if the profile.yml is read once when the extension is initialized, and no updates of env_vars are considered. However since it works for other functions of the extension (like e.g. dbt run) I doubt that thats the case here.

### Log output/Screenshots

_No response_

### Operating System

Debian 11

### dbt version

1.7.3

### dbt Adapter

bigquery

### dbt Power User version

0.31.3

### Are you willing to submit PR?

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.