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

sqlalchemy.func.* all infer to NullType #94

Open
MaicoTimmerman opened this issue May 6, 2021 · 1 comment
Open

sqlalchemy.func.* all infer to NullType #94

MaicoTimmerman opened this issue May 6, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@MaicoTimmerman
Copy link
Contributor

MaicoTimmerman commented May 6, 2021

Describe the bug
When functions are called from the sqlalchemy.func import they are all of type sqlalchemy.sql.functions.Function[sqlalchemy.sql.sqltypes.NullType].

Expected behavior
Have the same type when importing from:

  • sqlalchemy.func
  • sqlalchemy.sql.functions

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

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.

from sqlalchemy import func
from sqlalchemy.sql import functions

reveal_type(func.now())
reveal_type(functions.now())

Error

column_server_default_ticket_81.py:8: note: Revealed type is 'sqlalchemy.sql.functions.Function[sqlalchemy.sql.sqltypes.NullType]'
column_server_default_ticket_81.py:9: note: Revealed type is 'sqlalchemy.sql.functions.now[sqlalchemy.sql.sqltypes.DateTime]'

Have a nice day!

@MaicoTimmerman MaicoTimmerman added the bug Something isn't working label May 6, 2021
@MaicoTimmerman MaicoTimmerman changed the title sqlalchemy.func.* all infer to NullTYpe sqlalchemy.func.* all infer to NullType May 6, 2021
@bryanforbes
Copy link
Contributor

I think this is because _FunctionGenerator.__getattr__() needs to be typed better. I'm gonna have to look at what that's doing to get the function classes in the file before I propose a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants