-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Labels
bugSomething isn't workingSomething isn't workingmypy pluginsomething that has to do with the sqlalchemy mypy pluginsomething that has to do with the sqlalchemy mypy plugin
Description
Scenario that works as expected:
test_db.py
:
from sqlalchemy import String
from sqlalchemy import Column
from sqlalchemy.orm import declarative_base
Base = declarative_base()
class User(Base):
__tablename__ = "user"
name = Column(String)
def __init__(self, *, name: str):
self.name = name
Command:
pipenv run mypy --follow-imports=skip test_db.py
Result:
Everything passes, yay! 🎉
Failure scenario:
test_db.py
:
from sqlalchemy import String
from sqlalchemy import Column
from base_file import Base
class User(Base):
__tablename__ = "user"
name = Column(String)
def __init__(self, *, name: str):
self.name = name
base_file.py
:
Base = declarative_base()
Command plus output:
pipenv run mypy --follow-imports=skip test_db.py
test_db.py:11: error: Incompatible types in assignment (expression has type "str", variable has type "Column[String]") [assignment]
Versions.
- OS: mac
- Python: 3.10.13
- SQLAlchemy: 1.4.49
- mypy: 1.3
- SQLAlchemy2-stubs:
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingmypy pluginsomething that has to do with the sqlalchemy mypy pluginsomething that has to do with the sqlalchemy mypy plugin