[CT-3079] [Bug] When file is prefixed with dbt_ in the file name it will run the python script twice
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
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
This is a pretty edge case but if a file is named dbt_somthing it will run twice
```
from dbt.cli.main import dbtRunner, dbtRunnerResult
db_cmd = dbtRunner()
res: dbtRunnerResult = db_cmd.invoke(["build", "--select", "nothing"])
print("This should only be seen once")
```
### Expected Behavior
the print statement to only run once
### Steps To Reproduce
Have a working dbt project
Run dbt with python in a file with the name dbt_something.py
```
from dbt.cli.main import dbtRunner, dbtRunnerResult
db_cmd = dbtRunner()
res: dbtRunnerResult = db_cmd.invoke(["build", "--select", "nothing"])
print("This should only be seen once")
```
### Relevant log output
```shell
05:17:39 Running with dbt=1.6.1
05:17:39 Running with dbt=1.6.1
05:17:40 Registered adapter: redshift=1.6.1
05:17:40 Found 184 models, 34 analyses, 10 seeds, 2 operations, 372 tests, 108 sources, 10 exposures, 0 metrics, 1176 macros, 0 groups, 0 semantic models
05:17:40 The selection criterion 'nothing' does not match any nodes
05:17:40
05:17:40 Nothing to do. Try checking your model configs and model specification args
This should only be seen once
05:17:41 Registered adapter: redshift=1.6.1
05:17:42 Found 184 models, 34 analyses, 10 seeds, 2 operations, 372 tests, 108 sources, 10 exposures, 0 metrics, 1176 macros, 0 groups, 0 semantic models
05:17:42 The selection criterion 'nothing' does not match any nodes
05:17:42
05:17:42 Nothing to do. Try checking your model configs and model specification args
This should only be seen once
```
### Environment
```markdown
- OS: windows 10
- Python: 3.10.11
- dbt: 1.6.1
```
### Which database adapter are you using with dbt?
redshift
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.