sqlalchemy2-stubs
sqlalchemy2-stubs copied to clipboard
type wrongly inferenced when using sqlalchemy.asc
Describe the bug type inferenced is int
Expected behavior
type inferenced should be Uninon of int and Column

To Reproduce session.query(Object).order_by(asc(Object.field)) where field is of type Column(Integer)
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: Windows
- Python: 3.9
- SQLAlchemy: 1.4
- mypy: none
- SQLAlchemy2-stubs: latest
Additional context using PyCharm 2021
Have a nice day!
Hi,
What is the model definition?
At the moment I think this need the mypy pluging to work properly, I'm not sure what pycharm uses to provide inference.
We are experimenting with some changes that hopefully will improve things.
Thanks for reporting