DBIx::Class - Related Tables
Aaron Trevena
aaron.trevena at gmail.com
Tue Oct 7 14:32:04 BST 2008
2008/10/7 Andy Wardley <abw at wardley.org>:
> Dave Cross wrote:
>>
>> This is probably simple,
>
> This is the general problem that I have with ORMs. You have something
> which is a fairly straightforward SQL query but can't figure out how to
> make the ORM generate the query that you already know you want.
99.9% of the time that is either a rare edge case, or a case of not being
totally up to speed.
Look at the responses - at least a couple of people using dbix-class
could rattle
off the code as quickly as Dave could the raw sql.
That reflects my experience too -- I've been able to produce code using an ORM
quicker than others on this project could put together the sql, that's
because not
only do I know SQL reasonably well (I'm no Joe Celka) but I've become
increasingly
familiar with the ORM (although I still turn to irc and the list for help).
When I first started I could do maybe a quarter of the queries quicker
by handrolling sql,
now it's probably less than 1 in 10, and most of those I can still use
the ORM to do some
heavy lifting by fetching column names, table names, and db handles,
and even then,
8/10 times I still use SQL::Abstract to build the query.
> It's a bit like using a phrasebook to speak a foreign language. They're
> great for ordering a croissant in a cafe, but are ultimately limited and
> in some cases, can be counter-productive.
Nope.
It's a case of knowing your tools, and using the appropriate ones for
the job, the popular
perl ORMs allow you to fall back to using handcoded SQL, or to
over-ride default behaviour,
or you can just mix some raw sql/dbi into your code without having to
rip out all the ORM.
A.
--
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting
More information about the london.pm
mailing list