On 07/19/2016 11:51 AM, TomS. wrote:
Hi, We have Flask app which uses SQLAlchemy. Weird error started to happen recently. The difficulty is that we can't reproduce the error (/figure out conditions causing issue) - maybe someone could help. Any hints/tips would be appreciated. There is a part in the code which constructs IN in SQL: MyModel.id.in_(my_ids) For some cases my_ids is an empty list. It works without any problems, but after some time the same query (using empty list) starts to raise an exception: SAWarning: The IN-predicate on "MyModel.id" was invoked with an empty sequence. This results in a contradiction, which nonetheless can be expensive to evaluate. Consider alternative strategies for improved performance. After restarting app, everything works again. The question is - why this exception is not risen always (although we tried to run app with empty list directly), but after some time of app execution (~1 day)?
It's not an exception, it's a warning. Python warnings by default emit only once, see: https://docs.python.org/2/library/warnings.html#the-warnings-filter
Details: Flask==0.10.1 Flask-SQLAlchemy==2.1 SQLAlchemy==1.0.14 MySQL DB Cheers
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.