my_ids = [] is initialized in the body of static method (on the top of
it) which is run via Flask's route decorator.
But I can't understand why following code:
my_ids = []
MyModel.id.in_(my_ids)
doesn't raise SAWarning if 'an empty sequence' causes warning.
Cheers
On 07/19/2016 06:14 PM, Антонио Антуан wrote:
Looks like `my_ids` become empty 'after some time of app execution'.
How do you initialize the variable?
вт, 19 июля 2016 г., 18:51 TomS. <[email protected]
<mailto:[email protected]>>:
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)?
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 [email protected]
<mailto:sqlalchemy%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
Антон
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.