Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A sessionmaker overload is missing the **kw argument #84

Closed
Parnassius opened this issue May 1, 2021 · 0 comments · Fixed by #85
Closed

A sessionmaker overload is missing the **kw argument #84

Parnassius opened this issue May 1, 2021 · 0 comments · Fixed by #85
Labels
bug Something isn't working

Comments

@Parnassius
Copy link
Contributor

Describe the bug
The annotation for one of sessionmaker's overloads seems to be missing the **kw: Any parameter, causing the code below to fail.

Expected behavior
Mypy shouldn't complain when calling sessionmaker with the future=True flag.

To Reproduce

from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine('sqlite:///', future=True)

Session = sessionmaker(engine, future=True)

Error

foo.py:6: error: No overload variant of "sessionmaker" matches argument types "Engine", "bool"
foo.py:6: note: Possible overload variants:
foo.py:6: note:     def [_TSessionMakerType] __init__(self, bind: Union[Connection, Engine, None] = ..., class_: None = ..., autoflush: bool = ..., autocommit: bool = ..., expire_on_commit: bool = ..., info: Optional[Mapping[Any, Any]] = ...) -> sessionmaker[Session]
foo.py:6: note:     def [_TSessionMakerType] __init__(self, bind: Union[Connection, Engine, AsyncConnection, AsyncEngine, None], class_: Type[_TSessionMakerType], autoflush: bool = ..., autocommit: bool = ..., expire_on_commit: bool = ..., info: Optional[Mapping[Any, Any]] = ..., **kw: Any) -> sessionmaker[_TSessionMakerType]
foo.py:6: note:     def [_TSessionMakerType] __init__(self, *, bind: Union[Connection, Engine, AsyncConnection, AsyncEngine, None] = ..., class_: Type[_TSessionMakerType], autoflush: bool = ..., autocommit: bool = ..., expire_on_commit: bool = ..., info: Optional[Mapping[Any, Any]] = ..., **kw: Any) -> sessionmaker[_TSessionMakerType]
Found 1 error in 1 file (checked 1 source file)

Versions.

  • OS: Debian 10
  • Python: 3.7.10, 3.8.9, 3.9.4
  • SQLAlchemy: 1.4.12
  • mypy: 0.812
  • SQLAlchemy2-stubs: 0.0.1a5

Have a nice day!

@Parnassius Parnassius added the requires triage New issue that requires categorization label May 1, 2021
Parnassius added a commit to Parnassius/sqlalchemy2-stubs that referenced this issue May 1, 2021
@CaselIT CaselIT added bug Something isn't working and removed requires triage New issue that requires categorization labels May 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants