[sqlalchemy] Session.add performance

2010-12-15 Thread Julian Scheid
In an application that is heavy on inserts and updates, cProfile output is dominated by Session.add in which about 45% of time is spent. Most of that time, in turn, is spent in cascade_iterator (43%). I can provide more detailed information if needed. The application does aggressive caching of dat

[sqlalchemy] Re: Why does Session.merge only look at primary key and not all unique keys?

2010-12-15 Thread Russell Warren
>> Why does Session.merge only look at primary key and not all unique >> keys? > > Well the theory of operation regarding merge() is based on that of > the identity map, which is linked to object/row identity. > Consider that it also cascades along relationship paths. It would > be a difficult ope

Re: [sqlalchemy] Use of table aliases

2010-12-15 Thread Michael Bayer
On Dec 15, 2010, at 9:04 AM, neurino wrote: > Hello I have 2 tables: data and acquisitions, > - each Acquisition has many Data > - each Data come from a different sensor > - the single sensor is identified by the couple Acquisition.id_centr, > Data.id_meas > > No I need a query with one colum fo

Re: [sqlalchemy] Something like orderinglist for secondary tables?

2010-12-15 Thread Torsten Landschoff
Hi Michael, Sorry for not following up on your reply. I only came back to this list today. :) On Thu, 2010-11-18 at 11:34 -0500, Michael Bayer wrote: > > Okay, I updated my example code and it actually works now. However, it > > feels like a lot of additional complexity just for adding order. >

Re: [sqlalchemy] Why does Session.merge only look at primary key and not all unique keys?

2010-12-15 Thread Michael Bayer
On Dec 15, 2010, at 5:14 PM, Russell Warren wrote: > Why does Session.merge only look at primary key and not all unique > keys? Well the theory of operation regarding merge() is based on that of the identity map, which is linked to object/row identity. Consider that it also cascades along

[sqlalchemy] Re: Why does Session.merge only look at primary key and not all unique keys?

2010-12-15 Thread Russell Warren
Whoops - my clipboard had an old pre-cleaned sample code in it that I pasted. Sorry about the excess lines... maybe the logging mod will be useful for some people, though? The code is still right, just not fully cleaned up. The first Column config is the one that works around the Sqlite PK/autoi

[sqlalchemy] Why does Session.merge only look at primary key and not all unique keys?

2010-12-15 Thread Russell Warren
Why does Session.merge only look at primary key and not all unique keys? Leaving aside some irritating DBMS restrictions on PKs and some automatic indexing that tends to happen, the PK is not fundamentally different than other unique keys and I don't see why SQLA distinguishes them from an integri

Re: [sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Michael Bayer
It was in fact a one liner, so you can go back to your original code if you use the latest 0.6 tip: http://hg.sqlalchemy.org/sqlalchemy/archive/rel_0_6.tar.gz thanks for the bug report ! On Dec 15, 2010, at 3:41 PM, Will Weaver wrote: > Wow, this has been a problem for me for the past 3 or 4

Re: [sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Will Weaver
Wow, this has been a problem for me for the past 3 or 4 days and took a while to get to that example. Defining the backrefs or the relationships in the opposite direction did the job. I had intentionally left out some of the backreffed relationships because I didn't need them for what I was worki

Re: [sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Michael Bayer
This is an interesting edge case and I can probably ensure that the dependency between Parent/Child is present in the unit of work even if there is no known linkage at the Child.parent level for the objects actually present - ticket #2002 is added for this. In the meantime, the uow needs to be

[sqlalchemy] Re: Deletion order during flush is not correct.

2010-12-15 Thread Will
An update. This problem does occur with sqlite it's just that sqlite doesn't enforce the foreign key so it doesn't throw an exception. # output that deletes in the proper order 2010-12-15 14:33:52,197 INFO sqlalchemy.engine.base.Engine.0x...d050 BEGIN (implicit) 2010-12-15 14:33:52,197 INFO sqlal

[sqlalchemy] Deletion order during flush is not correct.

2010-12-15 Thread Will
""" Hello, I've been recently having a problem with sqlalchemy not flushing deletes in the proper order. I've created a simple example for the problem that has been occuring. I tried to run this using sqlite and it doesn't have any problems, it is only with Postgresql. One thing of note is that

Re: [sqlalchemy] Re: Modeling a Tree-looking structure in SqlAlchemy.

2010-12-15 Thread Hector Blanco
Thank you all... As soon as I have the webserver where I'm going to use that structure up and running, I'll try it and i'll let you know... 2010/12/13 Laurent Rahuel : > Hello, > > You should also take a look at http://pypi.python.org/pypi/sqlamp/0.5.2, an > implementation of Materialized Path fo

[sqlalchemy] Use of table aliases

2010-12-15 Thread neurino
Hello I have 2 tables: data and acquisitions, - each Acquisition has many Data - each Data come from a different sensor - the single sensor is identified by the couple Acquisition.id_centr, Data.id_meas No I need a query with one colum for each sensor and a row for each Acquisition.datetime This

[sqlalchemy] Using multiple databases for reliability (NOT sharding)

2010-12-15 Thread Marcin Krol
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello everyone, I'm in process of writing a distributed application and I'd like to use SQLAlchemy as backend. However, it's not performance that is my concern, but reliability. Suppose I have n server nodes. Writing: I would like to be able to wr