Re: [sqlalchemy] SQLAlchemy orm attribute post-update hook?

2013-11-28 Thread Amir Elaguizy
Bayer wrote: On Nov 27, 2013, at 12:48 PM, Amir Elaguizy aela...@gmail.comjavascript: wrote: If I have a model like: class Test(Base): value = sqlalchemy.Column(db.String) and I have a function like: def on_value_change(model, oldValue): # Do stuff I'd

[sqlalchemy] SQLAlchemy orm attribute post-update hook?

2013-11-27 Thread Amir Elaguizy
If I have a model like: class Test(Base): value = sqlalchemy.Column(db.String) and I have a function like: def on_value_change(model, oldValue): # Do stuff I'd like on_value_change called *after* Test.value has been changed I know it's possible to do it *before* Test.value has

[sqlalchemy] Join textual query to SA query?

2013-08-13 Thread Amir Elaguizy
Hey guys, Questions about the following code in which I'm trying to take a textqual query and join it to a query builder query. 1) What is the correct way to do the in for the list of ids in the first query? My current way doesn't work and I'm not able to find a real good example 2) How can I

[sqlalchemy] Query caching allows two objects representing same underlying data in session?

2013-07-15 Thread Amir Elaguizy
I'm having this weird problem using the query caching recipes in which two instances of a model representing the same underlying dataset will both get into the session. I know this is happening because I put all of the models in a set() and there are two instances with the same underlying

Re: [sqlalchemy] Query compilation cost

2013-07-13 Thread Amir Elaguizy
? Thanks! Amir On Friday, July 12, 2013 4:53:37 PM UTC-7, Michael Bayer wrote: On Jul 12, 2013, at 7:03 PM, Amir Elaguizy aela...@gmail.comjavascript: wrote: I'd like a way to avoid the cost of repeatedly compiling the same query, especially in the context of relationship caching

[sqlalchemy] Query compilation cost

2013-07-12 Thread Amir Elaguizy
I'd like a way to avoid the cost of repeatedly compiling the same query, especially in the context of relationship caching. Specifically now that I have object caching in place, I have created my own keys where it is possible. However there are still some cases where I cannot. In these cases

[sqlalchemy] Dogpile caching: can't pickle function objects

2013-07-11 Thread Amir Elaguizy
If I do a query like this: return PcpPostModel.query.filter_by(id=post_id).options( FromCache(default) ) and then later I do another query like this: PcpPostModel.query.options(FromCache(default)).all() Any models that were returned by the first query are

[sqlalchemy] Join order determinism

2013-07-11 Thread Amir Elaguizy
I noticed that between runs my cache hit rate using dogpile query caching could change without any of the underlying data structures changing, after digging in what I found was the join order on my polymorphic classes is not deterministic. Is there any way to ensure a deterministic join order

Re: [sqlalchemy] Dogpile caching: can't pickle function objects

2013-07-11 Thread Amir Elaguizy
, at 11:43 AM, Amir Elaguizy aela...@gmail.comjavascript: wrote: If I do a query like this: return PcpPostModel.query.filter_by(id=post_id).options( FromCache(default) ) and then later I do another query like

Re: [sqlalchemy] Join order determinism

2013-07-11 Thread Amir Elaguizy
)) return util.WeakSequence(descendants) def polymorphic_iterator(self): On Jul 11, 2013, at 2:00 PM, Amir Elaguizy aela...@gmail.comjavascript: wrote: I noticed that between runs my cache hit rate using dogpile query caching could change without any of the underlying data

Re: [sqlalchemy] Join order determinism

2013-07-11 Thread Amir Elaguizy
I'd need to come up with a test. On Jul 11, 2013, at 2:19 PM, Amir Elaguizy aela...@gmail.comjavascript: wrote: Michael, That works! Amir On Thursday, July 11, 2013 11:17:27 AM UTC-7, Michael Bayer wrote: when you say between runs, you mean whole new processes with new mappers

[sqlalchemy] YCombinator startup seeks SQLAlchemy performance contract engineer

2013-07-08 Thread Amir Elaguizy - Toutpost Founder
pay fairly well. We really need someone who is available immediately. If interested please e-mail me: a...@toutpost.com Thanks! Amir Elaguizy Founder of Toutpost a...@toutpost.com *Technical overview of the issue:* We're paying massive costs in CPU time building the models, even though our

Re: [sqlalchemy] nested inheritance / polymorphic relationships

2013-06-04 Thread Amir Elaguizy
, Michael Bayer wrote: On Jun 4, 2013, at 1:55 AM, Amir Elaguizy aelag...@gmail.comjavascript:; wrote: Hi there, I have a tree that looks like this, reflected via polymorphic inheritance: what do we mean reflected here, are you reflecting tables from the database, that is, http

[sqlalchemy] Re: nested inheritance / polymorphic relationships

2013-06-04 Thread Amir Elaguizy
on this particular issue. On Monday, June 3, 2013 10:55:15 PM UTC-7, Amir Elaguizy wrote: Hi there, I have a tree that looks like this, reflected via polymorphic inheritance: A / | \ B C D That works great, like: class BaseModel(db.Model): # Table A in diagram