dbt-labs / dbt-labs/dbt-adapters
[Bug] Mypy stubs not imported behind TYPE_CHECKING guard
- Dominant language
- Python
- Stars
- 233
- Forks
- 362
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 9
Description
### Is this a new bug?
- [x] I believe this is a new bug
- [x] I have searched the existing issues, and I could not find an existing issue for this bug
### Which packages are affected?
- [ ] dbt-adapters
- [ ] dbt-tests-adapter
- [x] dbt-athena
- [ ] dbt-athena-community
- [ ] dbt-bigquery
- [ ] dbt-postgres
- [ ] dbt-redshift
- [ ] dbt-snowflake
- [ ] dbt-spark
### Current Behavior
We needed to exclude `mypy-boto3-*` stub libraries from our build because it was conflicting with the newer `types-boto3-*` libraries. This caused an import failure and blocked our `dbt-athena` models from running.
### Expected Behavior
I would like to be able to run `dbt-athena` without requiring the legacy stub libraries.
### Steps To Reproduce
1. Create a new UV project including the latest `dbt-athena`
2. Exclude `boto3-stubs`, `mypy-boto3-athena`
3. Install your dependencies
4. Run `dbt debug --profile athena`
### Relevant log output
```shell
[2026-01-13, 14:49:18 UTC] {subprocess.py:106} INFO - File "/home/airflow/.local/lib/python3.12/site-packages/dbt/adapters/athena/impl.py", line 22, in
[2026-01-13, 14:49:18 UTC] {subprocess.py:106} INFO - from mypy_boto3_athena.type_defs import DataCatalogTypeDef, GetWorkGroupOutputTypeDef
[2026-01-13, 14:49:18 UTC] {subprocess.py:106} INFO - ModuleNotFoundError: No module named 'mypy_boto3_athena'
```
### Environment
```markdown
- OS: Debian GNU/Linux 12 (bookworm)
- Python: 3.12.10
- uv: 0.9.24
- dbt-adapters: 1.14.3
- dbt-athena: 1.9.4
```
### Additional Context
Inspecting `dbt/adapters/athena/impl.py` reveals that these type imports are not behind the existing `if TYPE_CHECKING:` guard. I verified this is still the case on the latest version of this file.
```python
from mypy_boto3_athena.type_defs import DataCatalogTypeDef, GetWorkGroupOutputTypeDef
from mypy_boto3_glue.type_defs import (
ColumnTypeDef,
GetTableResponseTypeDef,
TableInputTypeDef,
TableTypeDef,
TableVersionTypeDef,
)
...
if TYPE_CHECKING:
from mypy_boto3_glue.client import GlueClient
```
The the boto3-stubs are also required as a main dependency on the project instead of an optional dev dependency.
Contributor guide
Assessment
This issue has not been assessed yet.