woogs has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone I have a question pertaining to the appropriate use cases for packages like DBIx::Class::Schema and friends. I'm building a reporting framework, using Catalyst as a display/admin interface. The reports themselves are all being stored in a Postgres database. The database is subdivided into schemas, and makes liberal use of views, functions and privilege separation (I'm even using GSSAPI cred. delegation through Apache/Catalyst to Postgres) Reading through the Catalyst docs (and the book), DBIx::Class and friends are plugged frequently as the most sane way to do the model part of MVC. Upon using DBIx::Class::Schema::Loader, I realized it could not automatically create a model because of my use of schemas in my database. I've considered my projected workload, which is read often/write infrequently/update almost never. I've also considered the nature of some of my in-progress reports (they leverage functionality in the database like temp tables to generate reports) Given that I will have to make all my DBIx::Class::Schema objects by hand, will I come out ahead by making a complete model in that manner? Or am I better off sticking with posing relevant queries directly to DBI, and forgoing the use of DBIx::Class? If anyone has any experience with the +/- of building model classes for this style of database, I'd appreciate your insights.
  • Comment on Is DBIx::Class::Schema a good fit for me?

Replies are listed 'Best First'.
Re: Is DBIx::Class::Schema a good fit for me?
by moritz (Cardinal) on May 08, 2010 at 19:26 UTC
    Given that I will have to make all my DBIx::Class::Schema objects by hand, will I come out ahead by making a complete model in that manner? Or am I better off sticking with posing relevant queries directly to DBI, and forgoing the use of DBIx::Class?

    That depends on how you want to use the data that comes out of a database. If you want an object for each row, DBIx::Class can be a real time saver. If you want convenient access to related objects too.

    If you don't want that, there's not much point in using DBIx::Class.

    So far I've used DBIx::Class in only one non-small project, and even though I've set up all the DBIx::Class classes for the tables myself, I'm glad I've used it. I would have ended up wrapping the data in objects anyway.

    Perl 6 - links to (nearly) everything that is Perl 6.