Re: [sqlalchemy] event overhead question

2018-10-11 Thread Jonathan Vanasco


On Thursday, October 11, 2018 at 11:26:57 PM UTC-4, Mike Bayer wrote:
>
>
> the overhead of using @event.listens on that setter will be almost 
> undetectable.of course it also depends on what you're doing once 
> youre in the event handler. 
>
>
Great!  Thanks.  I'm just setting a bunch of attributes on the object to 
None.

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


Re: [sqlalchemy] event overhead question

2018-10-11 Thread Mike Bayer
On Thu, Oct 11, 2018 at 11:01 PM Jonathan Vanasco  wrote:
>
>
>
> On Thursday, October 11, 2018 at 7:29:32 PM UTC-4, Mike Bayer wrote:
>>
>>
>> overhead is fairly minimal, but also, a "set" is something you're
>> doing at very specific times, so, how much is this "set" being called
>> typically?
>
>
> The app is a read-heavy CMS. This "set" happens on the Article's body via 
> create or edit. These two write operations are maybe 1/1000th the volume of 
> total writes, and writes are maybe 1 per 100k reads.
>
> Using the event would be a small convenience in some ways and a good a backup 
> plan, but the system can easily use a custom setter for the object.

the overhead of using @event.listens on that setter will be almost
undetectable.of course it also depends on what you're doing once
youre in the event handler.

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

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


Re: [sqlalchemy] event overhead question

2018-10-11 Thread Jonathan Vanasco


On Thursday, October 11, 2018 at 7:29:32 PM UTC-4, Mike Bayer wrote:
>
>
> overhead is fairly minimal, but also, a "set" is something you're 
> doing at very specific times, so, how much is this "set" being called 
> typically? 
>

The app is a read-heavy CMS. This "set" happens on the Article's body via 
create or edit. These two write operations are maybe 1/1000th the volume of 
total writes, and writes are maybe 1 per 100k reads.

Using the event would be a small convenience in some ways and a good a 
backup plan, but the system can easily use a custom setter for the object.  

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


Re: [sqlalchemy] event overhead question

2018-10-11 Thread Mike Bayer
On Thu, Oct 11, 2018 at 7:27 PM Jonathan Vanasco  wrote:
>
> I try to stay away from Events in production.
>
> I now need to catch modifications of a particular column in order to expire 
> some data cached onto the object.
>
> Is there a measurable overhead for catching a single column? e.g.
>
> @event.listens_for(ObjectClass.column, 'set')
>
> The alternative is to use a setter function - which I am fine with.
>
> This is in an app that needs to be a bit more performance oriented, so I 
> figured I would ask before doing a benchmark.

overhead is fairly minimal, but also, a "set" is something you're
doing at very specific times, so, how much is this "set" being called
typically?




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

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


[sqlalchemy] event overhead question

2018-10-11 Thread Jonathan Vanasco
I try to stay away from Events in production.

I now need to catch modifications of a particular column in order to expire 
some data cached onto the object.

Is there a measurable overhead for catching a single column? e.g.

@event.listens_for(ObjectClass.column, 'set')

The alternative is to use a setter function - which I am fine with. 

This is in an app that needs to be a bit more performance oriented, so I 
figured I would ask before doing a benchmark.

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