Is there something easier than ORM?

Philip Semanchuk philip at
Tue Feb 17 17:35:00 CET 2009

On Feb 17, 2009, at 7:27 AM, 一首诗 wrote:

> Hi all,
> Recently I am studying some python ORM libraries, such as sqlalchemy.
> These are very powerful technologies to handle database.  But I think
> my project are not complicated to enough to benefit from a complete
> ORM system.
> What I really want, is some easy ways to load data from database, and
> change rows of data to list of named tuple, then I could send these
> data to my client application.
> I don't think I want these subtle behavior such as lazy load, auto
> update, ect. in ORM.
> So is there some libraries like that?
> Or is there some tools that could generate code from database scheme
> as I want?

As others have suggested, there are lower-level libraries for database  
access, like the sqlite library included with Python >= 2.5.

The API wrapper I'm most familiar with (psycopg2) has some nice  
features like returning Postgres text as Python strings and Postgres  
ints as Python ints and Postgres arrays as Python lists. It can also  
return rows as dictionaries keyed by column names. You get some nice  
things for free.

I read someone's advice that one doesn't need an ORM for simple  
projects but they become more useful as projects grow in complexity.  
I'm not so sure of that. I felt like the opposite could well be true  
-- the limitations inherent in a general purpose tool like an ORM are  
less likely to be a problem in a small, simple project than a larger  

In short, I gather that others on this list are a lot more fond of  
SqlAlchemy and ORMs in general than I am. Granted, my experience is  
very limited. I tried to integrate SqlAlchemy in one project,  
struggled for a long time to express how I wanted my tables joined,  
and finally found that performance was bad compared to our homegrown  
SQL. My boss and I were both very comfortable with SQL and were happy  
to go back to writing our own SQL statements and coding a data access  

I don't intend this as a criticism of SqlAlchemy. On the contrary I am  
impressed by what it does. But I often see people promoting ORM as the  
solution to all database access problems, and I certainly don't feel  
like it is.

Good luck,

More information about the Python-list mailing list