s3rius / FastAPI-template

Feature rich robust FastAPI template.
MIT License
1.9k stars 164 forks source link

Fix "opentelemetry.instrumentation.sqlalchemy" has no attribute "SQLAlchemyInstrumentor" [attr-defined] #95

Closed sorasful closed 2 years ago

sorasful commented 2 years ago

Hi there !

I've been trying the template with SQLAlchemy but the pre-commit wouldn't work because the line was too long and the # type: ignore would not go on the right line :

(centaure-7kcMhmah-py3.10)  xxx@xxx  ~/dev/centaure   master ✚  git commit -m "Initial commit"
Check python ast.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Check Toml...............................................................Passed
Fix End of Files.........................................................Passed
Add trailing commas......................................................Failed
- hook id: add-trailing-comma
- exit code: 1
- files were modified by this hook

Rewriting centaure/web/lifetime.py

Pretty format YAML.......................................................Passed
Format with Black........................................................Passed
autoflake................................................................Passed
isort....................................................................Passed
Check with Flake8........................................................Passed
Validate types with MyPy.................................................Failed
- hook id: mypy
- exit code: 1

centaure/web/lifetime.py:10: error: Module
"opentelemetry.instrumentation.sqlalchemy" has no attribute
"SQLAlchemyInstrumentor"  [attr-defined]
    from opentelemetry.instrumentation.sqlalchemy import (
    ^
Found 1 error in 1 file (checked 51 source files)

So, here's a quick fix.

s3rius commented 2 years ago

Wow, thanks!

sorasful commented 2 years ago

That's not much haha, but you're welcome !

s3rius commented 2 years ago

Will be released in 3.3.6.

s3rius commented 2 years ago

Hi there. I added request that eliminates missing imports problem for opentelemetry package. Please check it out.