Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
well, as a general non-specific view yes, it can be another approach. 
but, for the piece of code that drove me to this question, i really need 
to use after_flush  :)


cheers,
richard.

On 07/24/2015 02:15 PM, Jonathan Vanasco wrote:

Couldn't you handle much of this with the Descriptors/Hybrids pattern?

http://docs.sqlalchemy.org/en/latest/orm/mapped_attributes.html#using-descriptors-and-hybrids


--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
attachment: richard.vcf

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Jonathan Vanasco

On Friday, July 24, 2015 at 1:20:15 PM UTC-4, Richard Kuesters wrote:

  well, as a general non-specific view yes, it can be another approach. 
 but, for the piece of code that drove me to this question, i really need to 
 use after_flush  :)



Well I mean... you could use that pattern to catch and annotate the object 
with I've changed! info, then do your cleanup in the after_flush.

What popped into my mind as another use-case is this: touching an 
object's property to mark it dirty (even if SqlAlchemy doesn't interpret 
it as such, because the value is the same), then if it's not updated in the 
flush event, send the update anyways -- so a db-side stored procedure runs.

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Jonathan Vanasco
Couldn't you handle much of this with the Descriptors/Hybrids pattern?

http://docs.sqlalchemy.org/en/latest/orm/mapped_attributes.html#using-descriptors-and-hybrids

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
well, application-wise it is really to run other procedures, not from 
the database or python side, but from a message broker that's expecting 
anything to happen to that value -- even if it's just a touch :)


err ... it's quite a specific architecture for dumb clients, so i'm just 
taking some extra security measures ;)



On 07/24/2015 02:52 PM, Jonathan Vanasco wrote:


On Friday, July 24, 2015 at 1:20:15 PM UTC-4, Richard Kuesters wrote:

well, as a general non-specific view yes, it can be another
approach. but, for the piece of code that drove me to this
question, i really need to use after_flush  :)



Well I mean... you could use that pattern to catch and annotate the 
object with I've changed! info, then do your cleanup in the after_flush.


What popped into my mind as another use-case is this: touching an 
object's property to mark it dirty (even if SqlAlchemy doesn't 
interpret it as such, because the value is the same), then if it's not 
updated in the flush event, send the update anyways -- so a db-side 
stored procedure runs.

--
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 
mailto:sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com 
mailto:sqlalchemy@googlegroups.com.

Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
attachment: richard.vcf

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
yeah, that's basically what i'm doing: gathering information about 
what's happening and sending a response as quick as i can, since most of 
the clients are step machines (they still exists), so ... :)


On 07/24/2015 04:01 PM, Jonathan Vanasco wrote:


On Friday, July 24, 2015 at 2:06:15 PM UTC-4, Richard Kuesters wrote:

well, application-wise it is really to run other procedures, not
from the database or python side, but from a message broker that's
expecting anything to happen to that value -- even if it's just a
touch :)

err ... it's quite a specific architecture for dumb clients, so
i'm just taking some extra security measures ;)


It's not really that dump of an architecture.  I picked up on the 
value/importance of a simple touch.


Just throwing out some more ideas...

We have a caching system in place for public data for a pyramid app 
using SqlAlchemy and Dogpile(redis).  When objects are fetched form 
the cache, a `postcache` hook is performed and... if the object 
requires a lot of processing... it can register the object and an 
action into a global pool.  We then use an event in Pyramid to pop and 
process everything in the pool.


--
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 
mailto:sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com 
mailto:sqlalchemy@googlegroups.com.

Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


--
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
attachment: richard.vcf

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Jonathan Vanasco

On Friday, July 24, 2015 at 2:06:15 PM UTC-4, Richard Kuesters wrote:

  well, application-wise it is really to run other procedures, not from the 
 database or python side, but from a message broker that's expecting 
 anything to happen to that value -- even if it's just a touch :)

 err ... it's quite a specific architecture for dumb clients, so i'm just 
 taking some extra security measures ;)


It's not really that dump of an architecture.  I picked up on the 
value/importance of a simple touch.

Just throwing out some more ideas...

We have a caching system in place for public data for a pyramid app using 
SqlAlchemy and Dogpile(redis).  When objects are fetched form the cache, a 
`postcache` hook is performed and... if the object requires a lot of 
processing... it can register the object and an action into a global pool. 
 We then use an event in Pyramid to pop and process everything in the pool.

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.