AltimateAI / AltimateAI/vscode-dbt-power-user

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

Ouverte
#884 5 commentaires 1 réaction 1 personne assignée Réclamée par @mdesmet Voir sur GitHub
bug
Langage dominant
JavaScript
Étoiles
585
Forks
121
Merge moyen
5 j 39 min
PR mergées (30 j)
4

Description

### 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!

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.