Hello!
I want to introduce an artificial root object into my model to obtain
a traversable container hierarchy:
class Root:
foos = []
bars = []
Foo and Bar are both mapped classes and I had hoped to be able to do
something like
mapper(Root,
properties=dict(foos=relation(Foo), bars=relation(Bar))
It seems, however, that mapper insists on having *some* table to
select from (the error message I get is
"sqlalchemy.exc.ArgumentError: Mapper 'Mapper|Root|None' does not have
a mapped_table specified.").
Is there a clever way to do this?
Many thanks in advance,
Oliver
P.S.:
I know I can always resort to retrieving the foos and bars explicitly
with queries as in
class Root:
@property
def foos(self):
return Session.query(Foo).all()
but I want to keep the ORM stuff out of my model (plus it vexes me
that I don't seem to be able to solve this issue...)
--
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=.