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`.
What I don't quite get is that I've defined some other relations in a
similar way, and they seem to do the right thing, and I can't figure
out what the difference is. I've scoured every possible source but
can't figure this out. Does anyone know how to make the relation
substitute literal values from the instance?
I know that I can use a @property, but I'd rather use a `relation` for
various reasons.
Notes:
* The database is Oracle 11g
* Proper relations aren't defined in the database (i.e., there are no
foreign keys relating these tables)...
* ...but `route_number` *could* be a foreign key, and I have actually
defined it as such in my class (using ForeignKey in the Column
declaration)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---