sqlalchemy / sqlalchemy2-stubs

PEP-484 typing stubs for SQLAlchemy 1.4
MIT License
159 stars 41 forks source link

Cannot access member "add" for type "AsyncSession" (pylance) SQLAlchemy 1.4 #247

Open jacksbox opened 1 year ago

jacksbox commented 1 year ago

Describe the bug

I'm using VSCode with pylance and sqlalchmey=1.4.32.

If I try to use the add() method of the AsyncSession, I get an pylance error:

Cannot access member "add" for type "AsyncSession"

It works none the less, but the type hinting etc. is messed up.

To Reproduce

from sqlalchemy.ext.asyncio import AsyncSession

... # init the session, etc. pp

session.add()

Error

Cannot access member "add" for type "AsyncSession"

Versions

Additional context

No response

zzzeek commented 1 year ago

hi -

make sure you have no SQLAlchemy stubs installed within pylance they are still on sqlalchemy 1.4, it's a stubs problem.

Screenshot from 2023-01-16 08-57-14

zzzeek commented 1 year ago

oh this is SQLAlchemy 1.4 ? then this is part of sqlalchemy2-stubs, sorry