Friday, January 21

Geek

News From The Land Of Enchanted Rodents

I've been reading up on SQLAlchemy since my earlier adventures.  The developer's blog post on profiling convinced me that he knew what he was doing, and yet my benchmarking demonstrated that SQLAlchemy was unacceptably slow.

Clearly I was missing something.

What I was missing was what SQLAlchemy does at the high level - missing it because I wasn't looking at that level at all.  But the way my code was written, based on the respective tuorials from SQLAlchemy and Elixir, it was using the high level functions.

Which automatically map your objects to the database and keep them in sync.

So, basically, you can define a bunch of classes, define how they map onto the database tables, and just mess about with the objects and leave SQLAlchemy to persistificate them for you to any arbitrary SQL database.

Which is of course horribly complicated, and, in an interpreted language such as Python, kind of slow.

And not what I want to do right now.  Though it might come in handy at some point.

But - SQLAlchemy is split into two modules: The ORM (object-relational mapper), the high-end slow part, and the Core, a data abstraction layer, that just lets you do queries against different SQL databases without worrying about the fact that PostgreSQL and SQLite support INTERSECT but MySQL and Ingres don't.  Or do inserts of complex records without having to painstakingly count the %s in the query string and match them up against your parameters.

Which is exactly what I want.

And if I want to use the ORM in some self-contained modules where performance isn't critical, I can do that too.

So I'm off to run my benchmarks again and see what shakes out.

Update: (a) Still slow.  (b) Kind of horrible.

Posted by: Pixy Misa at 12:43 AM | No Comments | Add Comment | Trackbacks (Suck)
Post contains 300 words, total size 2 kb.

Comments are disabled. Post is locked.
41kb generated in CPU 0.04, elapsed 0.1649 seconds.
50 queries taking 0.1463 seconds, 280 records returned.
Powered by Minx 1.1.6c-pink.