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

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

Open
jacksbox opened this issue Jan 16, 2023 · 2 comments
Labels
bug Something isn't working PRs welcome

Comments

@jacksbox
Copy link

jacksbox commented Jan 16, 2023

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

  • Python: 3.11
  • SQLAlchemy: 1.4.32

Additional context

No response

@jacksbox jacksbox added the requires triage New issue that requires categorization label Jan 16, 2023
@zzzeek zzzeek removed the requires triage New issue that requires categorization label Jan 16, 2023
@zzzeek
Copy link
Member

zzzeek commented Jan 16, 2023

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
Copy link
Member

zzzeek commented Jan 16, 2023

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

@zzzeek zzzeek transferred this issue from sqlalchemy/sqlalchemy Jan 16, 2023
@zzzeek zzzeek changed the title Cannot access member "add" for type "AsyncSession" (pylance) Cannot access member "add" for type "AsyncSession" (pylance) SQLAlchemy 1.4 Jan 16, 2023
@CaselIT CaselIT added bug Something isn't working PRs welcome labels Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PRs welcome
Projects
None yet
Development

No branches or pull requests

3 participants