Hi,

SQLAlchemy populates an instance's __dict__ with lazily related instances 
when the attributes for these instances are first accessed (see 
here<https://groups.google.com/d/topic/sqlalchemy/CQTxTo4wdLg/discussion>for an 
ancient and huge discussion on the topic; I thought it's better to 
start afresh).

This breaks code that assumes __dict__ encapsulates object state (see 
here<https://github.com/twilio/flask-restful/issues/20>for a real world example 
when using 
flask-restful).

While several workarounds may alleviate this, I think the best approach 
here would be to create proxy objects to all relations in any instance's 
__dict__. These proxies can be transparently replaced with the real thing 
upon first access(if the list will agree with this approach, I'm willing to 
try my hand at producing a patch).

What do you think?

 - Yaniv

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/xolmXKu9ZEEJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to