Hello,

I'm busy to play with (joinded) inheritance in SQLAlchemy. I have to
design and implement a CMS-like app and my idea was to do something like
(it's the SQL script) : http://pastebin.com/m35f5227d 

As you can see it's a classic inheritance situation: a base Content
(abstract) which is of a certain ContentType (the polymorphic_on), and
more specialized objects (News, Events, ...) inherits from this base
Content class.

In the manual I read that :
"The table also has a column called type. It is strongly advised in both
single- and joined- table inheritance scenarios that the root table
contains a column whose sole purpose is that of the discriminator; it
stores a value which indicates the type of object represented within the
row. The column may be of any desired datatype"

In my situation the so-called "type" column is the "content_type_id",
which is foreign key, so for the News / Content relation in this case I
would have something like :

mapper(Content, contents, polymorphic_on=contents.c.content_type_id,
polymorphic_identity='?????')

mapper(Engineer, engineers, inherits=Employee,
polymorphic_identity='?????')

My question is: can I have a select() object which return a scalar for
the polymorphic_identity parameters ? I guess it should be possible to
put anything else than the FK value ?

Thanks,
Julien

-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: [EMAIL PROTECTED]
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52


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