Martin Aspeli wrote:
>
> How would the mapper configuration look if it were an expression? If it
> were a column?

this is the `polymorphic_on` attribute.  It generally expects to point to
a column.   Its not yet very flexible for expressions which is a TODO.  
an actual column in your base table (and each table which you'd like to do
polymorphic queries) would accomplish the desired result.

>
>>>    - I've had to repeat all the fields from the base class in the
>>> sub-classes. Otherwise, I'd get errors using those attributes, even
>>> though VehicleCar and VehicleBus both inherits form Vehicle.
>>
>> Well SQLA doesn't have any direct support for PG INHERITS, and the fact
>> is
>> that concrete inherits means that each Table repeats each common column
>> specifically - one reason why concrete inheritance is widely considered
>> to
>> be the most cumbersome form of relational inheritance.  There was a trac
>> ticket requesting that the columns "inherit" the way they do with a
>> simpler single- or joined- table setup, but at the end of the day that
>> request was asking for some very complex magic to occur.  Your database
>> expresses distinct columns at the public DDL level, even though INHERITS
>> means theyre the "same", so SQLA keeps it simple and would like you to
>> express them in the same way as what it will see when talking to the DB.
>
> True, except I think it's superflos. I could do this in Postgres too:

its superfluous except that SQLA wants to keep things simple and not guess
things about your schema.  theres a request which I closed here: 
http://www.sqlalchemy.org/trac/ticket/1469

--

You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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