[sqlalchemy] Re: saving existing db object

2011-04-13 Thread gwozdziu
Thanks Michael! I've got a small bug in my get_from_dto - I was getting object from db, and that was reason the object was updating. On Apr 8, 7:42 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Apr 8, 2011, at 12:59 PM, gwozdziu wrote: #before executing this code we have object with

[sqlalchemy] Re: multiple inheritance experiment

2011-04-13 Thread Lars
Hi Michael, I am trying to figure out the two suggestions you did, and not getting very far. Some basic questions: - if A, B, C are mapped classes, can you do A.join(B, A.id == B.id).join(C, B.id == C.id).join( ? - Would using join in such a way make access to mapped attributes in one of

[sqlalchemy] Re: Context based execution

2011-04-13 Thread bool
@compiles(Select) def contextual_select_thing(select, compiler, **kw): This method gets registered with Select. But How/When does this registration automatically happen? The caveat however for update/insert/delete when used with the ORM is that the mapper caches its compilation of these

Re: [sqlalchemy] Re: Context based execution

2011-04-13 Thread Michael Trier
The idiomatic way to modify the insert/update/delete construct within a flush is to use MapperExtension before_insert/before_update/before_delete to modify the mapped object's state right before it's flushed. Is there a recipe/code which I can quickly refer to get started on before_insert

[sqlalchemy] setting passive_deletes=True on an already existing database

2011-04-13 Thread neurino
This is (part of) my mapping: data = Table('data', metadata, Column('id', Integer, primary_key=True), Column('id_acq', Integer, ForeignKey('acquisitions.id'), index=True, nullable=False), Column('value', Float, nullable=True), ) acquisitions = Table('acquisitions',

[sqlalchemy] Re: Avoiding spaghetti inheritance

2011-04-13 Thread Lars
Hi Luca, There are a couple of things you could try: 1) Analyse the business logic further to figure out what fields structurally necessary for different types of product and/or important for queries, decide how far you want to take the inheritance tree from there. 2) Fields that are likely to

[sqlalchemy] ORM performance

2011-04-13 Thread Yang Zhang
We've been finding the SA ORM to be a large component in our application execution time. Our application makes frequent queries, and most of them simply query whole rows from a single table with some filters, but no joins (therefore, very basic queries). We've found that an alarming amount of

[sqlalchemy] SQLAlchemy 0.6.7 released

2011-04-13 Thread Michael Bayer
SQLAlchemy 0.6.7 is now available for download. While the focus has been on 0.7 for several months now and 0.7 is very close to production release, 0.6 has also been accumulating plenty of bugfixes. SQLAlchemy 0.6.7 can be downloaded at: http://www.sqlalchemy.org/download.html Note the

Re: [sqlalchemy] ORM performance

2011-04-13 Thread Michael Bayer
On Apr 13, 2011, at 9:07 PM, Michael Bayer wrote: On Apr 13, 2011, at 8:48 PM, Yang Zhang wrote: We've been finding the SA ORM to be a large component in our application execution time. Our application makes frequent queries, and most of them simply query whole rows from a single table

Re: [sqlalchemy] ORM performance

2011-04-13 Thread Chung
1. Query compilation... This resulted in ~2x improvement. that seems very strange - 2x improvement inthe overall speed of your application? I've done an enormous amount of profiling - SQL compilation is miniscule compared to the SQL statement's execution itself and the fetching

Re: [sqlalchemy] ORM performance

2011-04-13 Thread Michael Bayer
On Apr 13, 2011, at 10:05 PM, Chung wrote: 1. Query compilation... This resulted in ~2x improvement. that seems very strange - 2x improvement inthe overall speed of your application? I've done an enormous amount of profiling - SQL compilation is miniscule compared to the SQL