On my project, i use __getattr__ for adding column deifinition to object 
class
Such as: 

def __getattr__(self,attr):
    ...
      my_load_function(...)
      session.refresh(self)
   ...
    return getattr(self,attr)

It works, but refresh loses changes on this object. I cannot flush, because 
it used for another function.

I found solution 
session.refresh(self, attribute_names=['attr_name'])

But it will raise exception
sqlalchemy.exc.InvalidRequestError: No column-based properties specified 
for refresh operation. Use session.expire() to reload collections and 
related items.]

I already tried use session.expire(self) and session.expire(self, 
attribute_names=['attr_name'])) before and after refresh, but nothing 
changed

Can someone help me with this eror?

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to