17 December 2008

Pylons and SQLAlchemy

I recently gave Pylons and SQLAlchemy a spin. I mainly wanted to check out SQLAlchemy so that I could evaluate it for upcoming projects. Well, my opinion is that it is wildly flexible and, therefore, came with a steep learning curve. Pylons wasn't too hard to grasp although it seemed sort of arcane at times. I genuinely liked Pylons though.

This has been a disappointing experience for me. I wanted Pylons and SQLAlchemy to be fantastic so that I'd have a compelling reason to come back to Python full-time from Ruby. Not the case, I'm afraid. Looks like I'm going to be spending more time in the Ruby and Ruby on Rails camps in the future.

4 comments:

  1. I strongly disagree that wildly flexible == steep learning curve. Did you work through the official SQLAlchemy tutorial on the SQLA site ? It establishes a clear and unambiguous pattern of usage that covers a large majority of common use cases. The Elixir project exists to do the same thing, except in a more activerecord like way which should be very familiar to you if you've used ROR. If you're only relying on the somewhat shaky tutorials on the Pylons site, that's not a fair assessment.

    ReplyDelete
  2. @mike bayer: Yes, I worked through the ORM tutorial on the SQLALchemy site. In fact, I prototyped my models in SQLAchemy before I got Pylons involved. I had heard of Elixir too but really wanted to dive into the "native" parts of SQLAlchemy to learn it better.

    You're absolutely right that flexible need not imply complex. In my case, however, it did. That's just my $.02. YMMV.

    Ultimately, though, I was frustrated with how long it was taking to do things that I thought ought to be more straightforward (given my RoR ActiveRecord background). Specifically, laying out some of the multi-table relationships was tedious and non-obvious. This is purely a matter of opinion. But, since I have to bill my time, I really needed to understand things quickly.

    ReplyDelete
  3. You can say SQLA is more "tedious" due to the explicitness, but if it instead made lots of assumptions for you, you might say it were too "magic" and confusing.

    Anyway you should definitely use Elixir since it's configuration style is straight from ActiveRecord. It will create association tables, foreign keys, etc. without you having to specify any of that. SQLA core OTOH definitely doesn't want to generate your schema for you.

    ReplyDelete
  4. @mike bayer: great point and I'm with you on shunning "magic" side effects.

    If I decide to use Python on any upcoming projects that has any sort of need for persistent storage then I'll definitely check out Elixir.

    ReplyDelete