/sqlalchemy/sql/expression.py:1869: SAWarning: The IN-predicate on
"comment.reply_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.
  return self._in_impl(operators.in_op, operators.notin_op, other)

I try fix this warning.

user_comments_ids = tuple(x[0] for x in
getCommentsForUser(user_id).values('id'))
if user_comments_ids:
    comments_replies =
Comment.query.filter(Comment.reply_id.in_(user_comments_ids))
else:
    # empty query
    comments_replies = Comment.query.filter_by(id=None)
return comments_replies

but exists better solution?

Why not add to sqlalchemy Query method like .all(), .one(),  new
method .none() like in django orm?


Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to