dbt-labs / dbt-labs/metricflow
[Bug] `dbt parse --profile trino --target prod` followed by `mf query` doesn't use prod connection in `profiles.yml` in dbt-core 1.9.4
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 202
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 14
Description
### Is this a new bug in dbt-core?
- [x] I believe this is a new bug in dbt-core
- [x] I have searched the existing issues, and I could not find an existing issue for this bug
### Current Behavior
While upgrading to dbt-core 1.9.4 I have found out that the metricflow(mf query) command uses the default target and doesn't use the target specified in dbt parse command
I have multiple stages(targets) in my profiles.yml, each connecting to a different Trino cluster,
Before running any metricflow command I would first run
1. dbt parse --profile trino --target prod
2. mf query --metrics ..... --group-by .....
However when the mf query executes against the underlying database, the generated query has the schema(**dbt_prod**) mentioned in the target used in dbt parse command(**prod**) although it uses the trino host specified in the default target (**https://some_beta_trino_cluster**)
```
trino:
target: beta
outputs:
prod:
type: trino
schema: dbt_prod
host: https://some_prod_trino_cluster
...
gamma:
type: trino
schema: dbt_gamma
host: https://some_gamma_trino_cluster
...
beta:
type: trino
schema: dbt_beta
host: https://some_beta_trino_cluster
...
```
### Expected Behavior
dbt parse followed by mf query should use the connection target specified in the dbt parse command
### Steps To Reproduce
1. Create a profiles.yml with two different Trino targets , beta and gamma as shown in the above example
2. Run dbt parse --profile trino --target beta
3. Look at the generated query to find out that the schema is correct and as per the target used in dbt parse command
4. Look at Trino UI to find out in which cluster did the query run
### Relevant log output
```shell
```
### Environment
```markdown
- OS: Linux
- Python: Python 3.10.14
- dbt: Core:
- installed: 1.9.4
- latest: 1.9.4 - Up to date!
Plugins:
- athena: 1.9.3 - Up to date!
- redshift: 1.9.1 - Update available!
- postgres: 1.8.2 - Update available!
- trino: 1.9.1 - Up to date!
```
### Which database adapter are you using with dbt?
other (mention it in "Additional Context")
### Additional Context
Trino
Contributor guide
Assessment
This issue has not been assessed yet.