When I create a non-primary mapper for my class to add an additional
computed value in certain contexts when the query runs I get the
error:

AssertionError: No such polymorphic_identity 'M' is defined

This works fine with the primary mapper as several classes are defined
as having polymorphic identities. Is there a reason why this wouldn't
work?

It's entirely possible that I'm approaching this in the wrong way. One
of the primary queries used in our application does a distance search
and requires that several distances be calculated in order to perform
the query in a reasonable timeframe. This query is currently being
executed as a text statement. I'd like to end up with the normal
behaviour of orm but have the distance value attached to the object
when all is said and done.

The non-primary mapper has a 'distance' column_property which is just
declared as a Column() since the selecting is done with the text sql
statement.

Previously I was just selecting the id and distance and then running
separate queries to get each result as an object which seems horribly
inefficient. But it was working.

I'd appreciate some help with this. Thanks.

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

Reply via email to