Hello again,

I have implemented the in_() method which works great for all the
'normal' fields, but throws recursion errors when trying to deal with
the relation to another entity.

Cutting it down to one line:

# print
session.query(PolymorphicProperty).filter(PolymorphicProperty.entity.in_([entity1])).all()
  ...
  File "sqlalchemy/orm/properties.py", line 311, in operate
    return op(self, *other, **kwargs)
  File "sqlalchemy/sql/operators.py", line 47, in in_op
    return a.in_(b)
  File "sqlalchemy/sql/expression.py", line 1242, in in_
    return self.operate(operators.in_op, other)
  File "sqlalchemy/orm/properties.py", line 311, in operate
    return op(self, *other, **kwargs)
  RuntimeError: maximum recursion depth exceeded

Obviously I could use
# print
session.query(PolymorphicProperty).filter(PolymorphicProperty.entity_id.in_([entity1.id])).all()

but I thought it worth checking if the first case should work.


ta,


Martin



On May 27, 9:09 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On May 27, 2008, at 3:11 PM, Martin Pengelly-Phillips wrote:
>
>
>
> > Hi Michael,
>
> > Thank you for the quick response. I had thought about using a
> > straightforward OR statement - are you suggesting that this would form
> > the body of the in_() method on the Comparator or were you referring
> > more to just compiling the OR statements in the base query?
>
> i was saying the result of in_() would be a construct like:
>
> or_(*[col1.in_([x,y,z]), col2.in_([d, e, f]), ...])
>
> > Also, what is the correct expression for defining a subquery with the
> > ORM interface (I gather my embedded session.query statement currently
> > evaluates as a separate statement to return the list of candidates).
>
> any select() constituites a subquery when placed wihtin an enclosing
> select().   Often its a good idea to further enclose it in an Alias
> construct by saying select().alias().  Read through the SQL expression
> tutorial for examples.
>
> the subquery() method on Query wouldn't be used inside of a Comparator
> since theres no Query object available in those methods and its an
> overly heavy-handed approach at that level.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to