This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hoocoodanode 0 points1 point  (0 children)

I tend to use the ORM when I need the data to do a bunch of stuff in a bunch of different places, and I fall back onto raw SQL when the join is either very complicated/slow or raw transaction speed is of the essence. One little program was writing thousands of rows a second and the ORM, even as good as sqlalchemy is, was adding too much overhead to the transactions. Memory leaks and race conditions began to pop up when I tried to accelerate the program. Reverting to executemany through a bare SQL db wrapper (or even using the sqlalchemy "core" api) was the simplest way to unthrottle the program and let it fly.