Sebastian Elsner wrote:
> Hello,
>
>
> My first question is: What exactly is the commit doing to the list
> returned from the query so that pointers to other objects are "lost"
> (python.exe will crash on me then)?

The commit expires all attributes by default, since the transaction is
committed, and upon next access will be loaded again from the database. 
Feel free to turn this flag off if you don't want the reload.

There's no reason why any of this would crash the interpreter, however. 
It only means your model will refresh its information from the database.

> Or is there another solution? Is the design of my data structure (meaning
> having mapped classes simultaneously as tree nodes) crap?

oh.  What's this mean ?   I can't imagine what you'd be doing there.   If
it were like:

def foo(data):
    class Foo(object):
        data = data
    mapper(Foo, sometable)
    return Foo

for x in (1, 2, 3):
    myobject.collection.append(foo(x))

that would be more or less insane, sure.  But even then.  
myobject.collection is definitely not a SQLAlchemy instrumented attribute
- because its contents would have to be instances of a mapped class.  So
even with the above (entirely unnecessary and crazy) pattern, I don't see
how expiration is getting in the way.


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