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

type wrongly inferenced when using sqlalchemy.asc

Open taraskuzyk opened this issue 4 years ago • 1 comments

Describe the bug type inferenced is int

Expected behavior type inferenced should be Uninon of int and Column image

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!

taraskuzyk avatar Oct 08 '21 02:10 taraskuzyk

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

CaselIT avatar Oct 08 '21 08:10 CaselIT