sqlalchemy2-stubs icon indicating copy to clipboard operation
sqlalchemy2-stubs copied to clipboard

any, has on column attribute

Open minyoung90 opened this issue 3 years ago • 1 comments

Describe the bug mypy gives me,

has no attribute "any"

above error on column "User.addresses" attribute. also, "has" vise versa

stmt = (
  select(User.fullname).
  where(User.addresses.any(Address.email_address == '[email protected]'))
)
session.execute(stmt).all()

Expected behavior No errors

To Reproduce Please try to provide a Minimal, Complete, and Verifiable example. See also Reporting Bugs on the website, and some example issues.

see below example on document https://docs.sqlalchemy.org/en/14/tutorial/orm_related_objects.html#exists-forms-has-any

Please do not use Flask-SQLAlchemy or any other third-party extensions or dependencies in test cases. The test case must illustrate the problem without using any third party SQLAlchemy extensions. Otherwise, please report the bug to those projects first.

# Insert code here

Error

# Copy error here. Please include the full stack trace.

Versions.

  • OS: ubuntu 20.04 lts
  • Python: 3.9.4
  • SQLAlchemy:
  • mypy: 1.4.29
  • SQLAlchemy2-stubs: 0.0.2a20

Additional context

Have a nice day!

minyoung90 avatar Mar 13 '22 07:03 minyoung90

thanks for reporting

CaselIT avatar Mar 14 '22 11:03 CaselIT