Jump to content

What do you look for in an ORM?

KBenson's Photo
Posted Mar 17 2010 02:16 PM
3103 Views

I'm writing an Object Relational Mapper (yes, another) for perl, and I'm wondering what core features developers would like to see. The emphasis is on intuitive "core" features and ease of use. A major goal of this is to allow intuitive DB access while also being extremely small and with no non-core requirements.

Current features include:
  • Access, modification, saving, deleting and creration of records through OO interface
  • Inheritance allowing overriding accessor/setter methods for automatic conversion of data to/from database (e.g. auto convert datetime to SQL format or epoch, etc).
  • Searching of records based on all known fields through chained OO ($search->name_like("tom%")->id_ge(100);) syntax, criteria specification (hash-list syntax), or customer where clause string.
  • Search result iterations returning single record objects
  • Linking of search objects for table joins (with multiple record objects returned per iteration)

That said, am I missing the forest through the trees? Are there specific common ways you use an ORM that I'm not accounting for?

Tags:
1 Subscribe


1 Reply

+ 1
  monkeyvegas's Photo
Posted Mar 18 2010 01:21 AM

While I would dispute the need for another Perl ORM (what with Fey[::ORM], DBIx::Class, DBIx::DataModel, Class::DBI, ORLite, etc, etc), here are a few things I would need:

    * Automatic Class generation (including foreign and primary keys) from Database schemata
    * Database/Table generation from ORM Classes
    * SQL JOIN created based on has_a and has_many relationships
    * Understanding of plural and singular nouns in table classes
    * SQL::Abstract syntax for querying and updating


What I would like and which I don't have is the ability to run it transparently in asynchronous mode (either through AnyEvent::DBI (or the equivalent POE method), DBD::Pg's asynchronous support or forking) for event driven applications. There is AnyEvent::DBI::Abstract, but that is a bit less than a full ORM (it is just a combination of AnyEvent::DBI and SQL::Abstract).