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

Using compiles leads to untyped decorator

Open kasium opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug The compile decorator is not fully typed. Therefore mypy complains when using it

Expected behavior Mypy doesn't complain

To Reproduce Use compile as a decorator

Error

error: Untyped decorator makes function "foo" untyped  [misc]

Versions.

  • OS: Linux
  • Python: 3.7.1
  • SQLAlchemy: 1.4.41
  • mypy: 0.982
  • SQLAlchemy2-stubs: 0.0.2a29

I'm happy to give a PR a try

kasium avatar Oct 18 '22 09:10 kasium

Facing same issue


@compiles(Utcnow, 'postgresql')
def pg_utcnow(element, compiler, **kw):
    return "TIMEZONE('utc', CURRENT_TIMESTAMP)"


@compiles(Utcnow, 'mssql')
def ms_utcnow(element, compiler, **kw):
    return 'GETUTCDATE()'

verhovensky avatar Feb 15 '24 14:02 verhovensky