2010 Reflections - The Chainsaw Song

Uh-oh, December 1st - time does indeed fly, and it's time to recap what has happened in our-favorite-language-land. It is my honor to start off this year's Advent Calendar with a walk through the changelog of one of the most popular M's of your MVC - DBIx::Class.

The Past

So what exciting things have happened with your (hopefully) favorite SQL de-hater? The answer is - a lot!

First the obligatory numbers: this year up until the latest official release 0.08124 DBIC saw code and documentation contributions from 42 (no joke!) people in over 1,000 commits, touching over 400 files with a total of over 14,000 non-whitespace lines of changes! But what do these scary numbers give us?

The killer feature remains resultset chaining, but what a facelift it got this year: searches, relationship traversals, set operations, subselects, limits, column slices (and by the end of this week custom joins ) - all work together in perfect harmony, producing mind-numbing but fully functional SQL. Just slap your methods together and DBIC will almost always do the right thing (these days it even manages to surprise its authors).

Did I mention the mind-numbing SQL? Do you also avoid looking at SQL directly with the remaining eye? Well no more! Thanks to frew, SQL::Abstract (and thus by proxy DBIC) now comes with an awesome SQL formatter. Just add DBIC_TRACE_PROFILE=console to your environment and watch a rainbow of properly indented SQL dance on your otherwise dull console any time you request SQL traces with DBIC_TRACE or with storage->debug. Catalyst/Plack users are not left out in the cold either, thanks to jnap and his Plack::Middleware::Debug::DBIC::QueryLog, which leverages the same awesome formatting capabilities.

But we surely are taxing the RDBMS with these twisted queries, and the DBA knows where you live.... Fear not! DBIC ships with a wicked join-pruning optimizer (akin to the one available in PostgreSQL since 9.0). Of course being internal to DBIC it works on any database, and is more efficient since it has more metadata about the result sources. Just stack these joins and nested searches with reckless abandon, and DBIC will do its best to remove unreferenced LEFT JOIN's before sending the coveted query to the RDBMS.

So you have a DBA - you are most likely using some opinionated commercial RDBMS. Thanks to Caelum DBIC now supports oddballs like Informix, Firebird and Interbase, Sybase ASE and Sybase SQL Anywhere. Note that "supports" means real support - with proper limit dialects, datetime formatters, transaction handlers, savepoints, and other fixups and workarounds for minor but irritating RDBMS-specific quirks.

Outside of the main workflow there is still more news:

Thanks to frew DBIC now has a neat stack of handy helpers, organized in the DBIx::Class::Helpers distribution. Great for mixing and matching various small utilities to make data retrieval easier. He also managed to write DBIx::Class::DeploymentHandler - a replacement for the nice but architecturally limited DBIx::Class::Schema::Versioned. While it may seem daunting at first, it is well worth a look, as it makes a lot of advanced stuff possible (and even easy), for example in-line data migration during schema upgrades. Finally in order to attract more followers of the sugar-club, he spilled some DBIx::Class::Candy to make the life of DBIC newcomers sweeter^Weasier.

Caelum adopted DBIx::Class::Schema::Loader and taught it neat tricks on all databases he could get his hands on. The new generation loaders are more precise, support more database metadata, and quite importantly choose saner names for Result Classes and Relationships.

goraxe contributed a brand-new fully Moosified control module DBIx::Class::Admin, making it dead simple to write CLI apps and other control interfaces against your DBIC schema.

Last but not least the repository was migrated from SVN to GIT by the awesome Haarg. He not only properly transferred our non-trivial history, he blogged his way through it , documenting the bits and pieces necessary to pull off such a complex migration. As a direct result of this contributing to DBIC got even easier than before - simply fork our GitHub Mirror, edit and send pull requests directly from your browser without ever needing a checkout!

And many other small and big changes by dedicated individuals - my personal gratitude goes to you all for making DBIC the kick-ass project it is today!

The Present

But the year is not over yet! As I am writing this two major features are getting groomed for immediate CPAN release: the already mentioned custom relationships and INSERT ... RETURNING support for Oracle. Another exciting feature may land into master before New Year, but it will deserve its own announcement if it materializes. Suffice to say lots of hopes are set for the post-LPW hackathon :)

The Future

Well of course the future depends on YOU! The DBIx::Class team is as active as ever and is always looking for eager minds striving to make SQL-interaction even less hateful :) If you have tuits, ideas, comments, or plain old questions, stop by our hivemind irc.perl.org#dbix-class and become a part of a stellar community of Perl hackers (and hopefully a part of the next 1,000 commits :) )

On this note I pass the reins to the next Advent author. Once again thank you all for the awesome ride so far, and for the great things that are yet to come.

Cheers!

-- ribasushi, DBIx::Class chainsaw delegate in residence

AUTHOR

Peter Rabbitson <ribasushi@cpan.org>