Skip to content

Can't find __enter__ and __exit__ methods for sqlalchemy.orm.Session  #228

Open
@eldardzhorobekov

Description

@eldardzhorobekov

Hi. I'm getting this error when trying to use sqlalchemy.orm.Session as a context manager.

My code:
with sa.orm.Session(some_app) as session:

Errors:
error: "Session" has no attribute "enter"; maybe "iter"?
error: "Session" has no attribute "exit"

Package versions:
SQLAlchemy=1.4.23
sqlalchemy-stubs=0.4

P.S.
This is the first time I'm writing an issue. If you need any clarification or suggestions, please, feel free to ask :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions