Pylint: func.max is not callable

Question:

In my python code, I import func…

from sqlalchemy.sql.expression import func

Then, during my code I select data from a database table…

select(func.max(MyTable.my_datetime))

…where my_datetime is a DateTime data type…

from sqlalchemy.types import DateTime

my_datetime = Column('my_datetime', DateTime)

The code runs OK, but in the vscode editor I am getting the following error…

func.max is not callable Pylint(E1102:not-callable)

I don’t want to ignore this if there is a genuine concern behind this Pylint error.

Should I be concerned by this error or can I safely ignore it?

Asked By: Wannabe-Coder

||

Answers:

The Pylint error you have (func.max is not callable Pylint(E1102:not-callable)) is a false positive and you can ignore it in your case.

Pylint is flagging func.max not callable because it can’t analyze the func object statically and determine that it has a max method.

You can use

func: Callable

after importing .

Answered By: Elvin Jafarov
Categories: questions Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.