On Nov 12, 2007, at 2:07 PM, [EMAIL PROTECTED] wrote:

>
> hi
> 1st one:  i am saving some object; the mapperExtension of the object
> fires additional atomic updates of other things elsewhere  
> (aggregator).
> These things has to be expired/refreshed... if i only knew them.
> For certain cases, the object knows exactly which are these target
> things. How (when) is best to expire these instances, i.e. assure that
> nexttime they are used they will be re-fetched?
> a) in the mapperext - this would be before the flush?
> b) later, after flush, marking them somehow ?

the "public" way to mark an instance as expired is  
session.expire(instance).  if you wanted to do this inside the mapper  
extension, i think its OK as long as you do the expire *after* the  
object has been inserted/updated (i.e. in after_insert() or  
after_update()).

We also have the capability to mark any group of attributes as  
expired. however I havent gotten around to building a nice public API  
for that, though i can show you the non-public way if you want to play  
with it.  This API is used by the mapper after it saves your instance  
to mark attribues which require a post-fetch.

What I'd like to do, and this has been frustrating me a bit, is to  
bring the "expire the whole instance", "expire a group of attributes",  
"reload a group of attributes", and "reload an instance" under one  
implementation umbrella - right now theres some repetition in there  
among Mapper, Query._get() and DeferredColumnLoader.  I've sort of  
wanted to address the whole thing at once.

>
>
> and, why atomic updates also have with commit after them? or is this
> sqlite-specific?

every CRUD operation requires a commit.  DBAPI is always inside of a  
transaction.

>
>
> 2nd one: how to compare with a Decimal? i.e. tableA.c.column ==  
> Decimal('7')
> ah forget,  i found that, passing asdecimal =True to column's  
> Numeric()
> definition.
>
> btw, the precision/length arguments of Numeric seems misplaced??
> isnt format 10.2 meaning length 10 precision 2?
> or the meaning of "length" and "precision" is different here?

i think someone posted a ticket to change our terminology to  
"precision/scale".  ive *no* idea how the word "length" got in there,  
it was probably me very early on but I cant find any document anywhere  
that might have suggested to me that its called "length".



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