On Jul 28, 2011, at 7:05 PM, neurino wrote:
I tried create_instance event and it fires, now having:
def see_what_type(mapper, context, row, class_):
if **is_air**:
return Air()
else:
return EXT_CONTINUE
def initialize_sql(engine):
...
layer_mapper =
Thanks Michael,
I was until now using a plain
row[u'layers_id_type']
found inspecting row.keys() with debugger (quick and ditry way, I know...)
now I changed with your more orthodox
row[mytable.c.id_type]
(ahem...)
I should not have to deal with subqueries so it can stay this way for the
I need a Single Table Inheritance where the `type` column already
exists and is a foreign key - `id_type` - to `types` table.
My concern is I only need to map to two different classes:
- Foo for `polymorphic_identity=FOO_ID_TYPE`
- Bar for all other `id_type`s
Is there a way I can accomplish
On Jul 28, 2011, at 4:23 PM, neurino wrote:
I need a Single Table Inheritance where the `type` column already
exists and is a foreign key - `id_type` - to `types` table.
My concern is I only need to map to two different classes:
- Foo for `polymorphic_identity=FOO_ID_TYPE`
- Bar for all
Thanks Michael,
my need is quite easy, no need of complex querying.
Simply my class represents a Layer and, while quite all layer types
(concrete, wood, bricks, etc.) act the same, only one (air) acts in a
completely different way.
With act I refer to performing calculations on float
On Jul 28, 2011, at 6:08 PM, neurino wrote:
Thanks Michael,
my need is quite easy, no need of complex querying.
Simply my class represents a Layer and, while quite all layer types
(concrete, wood, bricks, etc.) act the same, only one (air) acts in a
completely different way.
With
I tried create_instance event and it fires, now having:
def see_what_type(mapper, context, row, class_):
if **is_air**:
return Air()
else:
return EXT_CONTINUE
def initialize_sql(engine):
...
layer_mapper = mapper(Layer, layers)
mapper(Air,