[sqlalchemy] Re: Conflict between SQLAlchemy = 0.4.4 and coverage.py?

2009-01-18 Thread James
Ah, ok thanks Michael - I'd found that bug from some googling, but Doug's comment here: http://groups.google.com/group/turbogears/msg/26d74c947dec400e implies that it was fixed in Python 2.5.2 (I'm using 2.5.4 - sorry I forgot to include that). However, the comments on the official Roundup bug

[sqlalchemy] How to improve performance of sqlalchemy based application?

2009-01-18 Thread Victor Lin
Hi, I am building some applications that insert data to database heavily. I commit in for-loop every iteration. It seems that it is not a smart way to commit data every iteration. SQL queries implies expensive IO action. So I think that would be better to buffer data and flush them. The question

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-18 Thread Andreas Jung
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 18.01.2009 16:32 Uhr, Victor Lin wrote: Hi, So I think that would be better to buffer data and flush them. This is easily spoken the implementation pattern of SA: unit-of-work. You might check the documentation. - -aj -BEGIN PGP

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-18 Thread Michael Bayer
inserting bulk data is most efficient if you use an insert many: connection.execute( table.insert(), [{..row...}, {...row...}, {...row..} ..] ) For additional performance, you want to ensure that the above insert is not relying on any python-level default executions (like when

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-18 Thread Ramiro Morales
On Sun, Jan 18, 2009 at 1:32 PM, Victor Lin borns...@gmail.com wrote: Hi, I am building some applications that insert data to database heavily. I commit in for-loop every iteration. It seems that it is not a smart way to commit data every iteration. SQL queries implies expensive IO action.

[sqlalchemy] Re: How to improve performance of sqlalchemy based application?

2009-01-18 Thread Ramiro Morales
On Sun, Jan 18, 2009 at 1:46 PM, Ramiro Morales cra...@gmail.com wrote: Take a look at ticket #6095 to know the motivation and rationale behind the addition of the through option and some of the advantages when compared with using you own model with FKs to the two related models. Also and

[sqlalchemy] Adjacency List tree - inefficient reading

2009-01-18 Thread Kless
SQA recommends the adjacency list pattern [1] over another patterns: Despite what many online articles say about modified preorder, the adjacency list model is probably the most appropriate pattern for the large majority of hierarchical storage needs, for reasons of concurrency, reduced

[sqlalchemy] Re: Adjacency List tree - inefficient reading

2009-01-18 Thread Michael Bayer
We have a proof of concept for nested sets in the /examples folder. However what I cant figure out with nested sets is, how do I load only the immediate children of a node ?That is the most common accessor I'd like on a self referential node and I'm not aware of how to do it. It

[sqlalchemy] Testing SQLAlchemy applications without the database

2009-01-18 Thread Adam Dziendziel
Hello, I'm working on a larger project which is using SQLAlchemy. We started with writing automated tests using an in-memory SQLite database and inserting test data in setUp() then emptying tables in tearDown(). Even though the in-memory SQLite is pretty fast, the process of inserting test data

[sqlalchemy] Re: Adjacency List tree - inefficient reading

2009-01-18 Thread Kless
The author of django-treebeard created the ns-tree implementation based on Joe Celko as SQAlchemy's [1]. Here is its implementation [2]. I hope that helps. [1] http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/nested_sets/nested_sets.py [2]

[sqlalchemy] Re: Adjacency List tree - inefficient reading

2009-01-18 Thread Adam Dziendziel
On 18 Sty, 19:47, Michael Bayer mike...@zzzcomputing.com wrote: However what I cant figure out with nested sets is, how do I load only   the immediate children of a node ?    That is the most common accessor   I'd like on a self referential node and I'm not aware of how to do   it.   It

[sqlalchemy] Re: Testing SQLAlchemy applications without the database

2009-01-18 Thread Michael Bayer
the easiest approach to this is to run each test within a transaction (begun during setUp()), and issue a rollback() during the tearDown() process. our own tests don't actually do this since we test hundreds of different table configurations, but I've used it with success in other

[sqlalchemy] Re: Testing SQLAlchemy applications without the database

2009-01-18 Thread az
u want to simulate what sqlalchemy is doing? i'd put some layer facading between the app and the sqlalchemy, then replace sqlalchemy with something else. that'll need a) test that assures the two facades behave equivalent, and b) the app tests should not rely on any partcular

[sqlalchemy] Re: Adjacency List tree - inefficient reading

2009-01-18 Thread Michael Bayer
On Jan 18, 2009, at 1:33 PM, Kless wrote: If any is interested in tree structures, there is an excelent implementation for django ORM, django-treebeard [2], which has included any benchmarks where you can see the reading differences between different structures. [1]

[sqlalchemy] Re: Testing SQLAlchemy applications without the database

2009-01-18 Thread Michael Bayer
On Jan 18, 2009, at 3:45 PM, Adam Dziendziel wrote: The approach using transactions would be great, but I'm afraid that it wouldn't work if the system under test uses transactions internally. I could switch from SQLite to a DBMS which supports nested transactions, but then I would lost the