Wyatt Lee Baldwin wrote:
>
> I have a relation defined like this in a declarative-style class:
>
>     route = relation(
>         RouteDef,
>         primaryjoin=(
>             (route_number == RouteDef.route_number) &
>             (route_begin_date >= RouteDef.route_begin_date)
>         ),
>     )
>
> What I *really* want is for `route_number` and `route_begin_date` to
> be substituted with literal values when I do `instance.route`.
> Instead, I get a big nasty join that runs forever. Instead of the
> generated SQL containing a literal date value, for example, the SQL
> contains the column name, `route_begin_date`.

I don't see this join condition related to the parent (or even what the
parent is).   So an eagerload will produce a big join, sure.  The join
expression needs to relate the child to the parent in some way.   Using
literals within that condition is not an issue.

--~--~---------~--~----~------------~-------~--~----~
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