hi there,
I am using a one to many relation, and would like the result to be ordered by a
field of the child table. however no order by statement is executed when I
access the related property of the parent object.
this is my declaration:
mitarbeiter_table = Table('mitarbeiter', Base2.metadata, autoload=True)
class mitarbeiterCL(Base2):
__table__ = mitarbeiter_table
abwesenheit_table = Table('abwesenheit', Base2.metadata, autoload=True)
class abwesenheitCL(Base2):
__table__ = abwesenheit_table
mitarbeiter = relation(
mitarbeiterCL,
uselist=False,
backref='abwesenheiten',
order_by = abwesenheit_table.c.datumvon,
)
when I then access the abwesenheiten property of a mitarbeiterCL object I get
the following sql statement executed.
2009-10-14 07:53:24,206 INFO sqlalchemy.engine.base.Engine.0x...194c SELECT
abwesenheit.awid AS abwesenheit_awid, abwesenheit.pid AS abwesenheit_pid,
abwesenheit.datumvon AS abwesenheit_datumvon, abwesenheit.datumbis AS
abwesenheit_datumbis, abwesenheit.grund AS abwesenheit_grund
FROM abwesenheit
WHERE %(param_1)s = abwesenheit.pid
what I would like is to get all abwesenheiten related to mitarbeiter ordered by
abwesenheiten.datumvon
what can I do to achieve this?
thanks for a great package
robert
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---