I've hit the problem explained here:
<http://groups.google.com/group/sqlalchemy/msg/499a0765d426e12b>
but I didn't quite understand how to work around it.

I have a series of mappings relations with lazy=True and one of them
in some situations seems having that problem.
To be honest everything worked fine with lazy=False, I just tried to
make it lazy to avoid some situations in which the
ORM does the wrong (and more resource painful) query.

It is a self referential mapping:

mapper(Job, job,
       properties=dict(
        tasks=relation(JobDetail, lazy=False, backref='job'),
        conf=relation(Configuration, lazy=False)))
mapper(JobDetail, jobdetail)

parent_rel = relation(
        Configuration, lazy=False,
        join_depth=5, # No more than 5 hierarchy levels
        remote_side=[configuration.c.config_name])
parameters_rel = relation(
    _ConfigurationDetail, lazy=False,
    
collection_class=column_mapped_collection(configuration_detail.c.param_name),
    cascade='all, delete-orphan')

mapper(Configuration, configuration,
       properties = dict(_parent=configuration.c.parent,
                         parent=parent_rel,
                         parameters=parameters_rel))

Turning the lazy argument from False to True makes this error appear:

"UnboundExecutionError: Parent instance <Configuration at 0x8ce466c>
is not bound to a Session; lazy load operation of attribute 'parent'
cannot proceed"


In the meantime I've fixed the the resource painful query using
options(lazyload('property')) but I'd really like to understand
what's going on.

Does someone have an idea?

-- 
Lawrence, neropercaso.it - oluyede.org
"It is difficult to get a man to understand
something when his salary depends on not
understanding it" - Upton Sinclair

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