object-relational mappers

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Apr 2 07:25:29 EDT 2008


hdante a écrit :
> On Apr 1, 5:40 pm, Aaron Watters <aaron.watt... at gmail.com> wrote:
>> I've been poking around the world of object-relational
>> mappers and it inspired me to coin a corellary to the
>> the famous quote on regular expressions:
>>
>> "You have objects and a database: that's 2 problems.
>> So: get an object-relational mapper:
>> now you have 2**3 problems."
>>
>> That is to say I feel that they all make me learn
>> so much about the internals and features of the
>> O-R mapper itself that I would be better off rolling
>> my own queries on an as-needed basis without
>> wasting so many brain cells.
>>
>> comments?
> 
>  Try Rails' ActiveRecord. Your problems should reduce to (lg lg
> 2)^(1/12).

Correct me if I'm wrong, but IIRC ActiveRecord requires you use numeric 
auto_increment fields for primary key. As far as I'm concerned, this is 
a definitive no-no.

>  Seriously, you'll forget there's a relational database below. 

Why on earth are you using a RDBMS if you don't want it ? I for one *do* 
care about using a *relational* database, and *don't* want to hide it 
away. What I don't want is to have to build my queries as raw strings. 
And that's where SQLAlchemy shines : it's not primarily an "ORM", it's 
an higher-level Python/SQL integration tool that let you build your 
queries as Python objects (and also, eventually, build an ORM if you 
want to...).





More information about the Python-list mailing list