[sqlalchemy] Re: column_property() caching

2007-12-04 Thread Marco Mariani

Vladimir Iliev wrote:
 hi, is it possible to add a non-caching column_property() to my mapping?
   

You can use expire() on a single column, so you could proxy that column 
with a @property that also expires it.



-- 
This e-mail (and any attachment(s)) is strictly confidential and for use only 
by intended recipient(s).  Any use, distribution, reproduction or disclosure by 
any other person is strictly prohibited. The content of this e-mail does not 
constitute a commitment by the Company except where provided for in a written 
agreement between this e-mail addressee and the Company.
If you are not an intended recipient(s), please notify the sender promptly and 
destroy this message and its attachments without reading or saving it in any 
manner.
Any non authorized use of the content of this message constitutes a violation 
of the obligation to abstain from learning of the correspondence among other 
subjects, except for more serious offence, and exposes the person responsible 
to the relevant consequences.


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



[sqlalchemy] Re: column_property() caching

2007-12-04 Thread Michael Bayer

the easiest way to do this would be to issue the SQL yourself...below
uses the object_session() and object_mapper() functions to ensure that
the current connection, if any, is used (you could also just say
myengine.execute() if that didnt matter):


class MyClass(object):
   @property
   def someprop(self):
   return object_session(self).\
execute(select([MyClass.somecol]).where(MyClass.id==self.id),
\
mapper=object_mapper(self)).scalar()


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