[Dbix-class] Question about dynamic class generation (DBIx::Class::Schema::Loader)

Matt S Trout dbix-class at trout.me.uk
Tue Feb 7 16:11:13 CET 2006


On Tue, Feb 07, 2006 at 03:35:43PM +0100, Leandro Hermida wrote:
> DBIx::Class::Schema::Loader should not be used in production environments.
> Is this true only because it is so new?  Or that it won't be recommended in
> general for the life of the module? (due to the way it works or something) 
> 
> I raise this question because I think either automatic class code generation
> or dynamic runtime generation is important to an ORM system like
> DBIx::Class.  One can have a database with a large number of tables and
> relationships and it would be too much work to maintain the
> DBIx::Class::Schema manually created class library.  For these types of
> projects you need to automatically generate the ORM classes.  An approach I
> have seen which comes to mind are the Apache Torque (Java) and Propel (PHP)
> projects.  Propel is essentially the PHP port of Torque.  In these ORM
> systems one creates a simple build properties file and defines what their
> database should look like using an XML schema (or, if the database exists,
> they can generate the XML schema from the existing database).  They then run
> the builder which automatically generates the entire all the ORM classes and
> the SQL DDL to create their database (if necessary).  Is this a stupid
> approach?  To me it seems very useful and it would save a developer a ton of
> time but I haven't seen any talk about making a Perl port of Torque or at
> least utilizing some of the ideas.  Does DBIx::Class want to provide
> features along these lines?

As of 0.05 there's an SQL::Translator parser for a DBIx::Class schema file
that allows you to generate SQL DDL for any database supported by SQLT; I
use it to generate the sqlite.sql file that's used to setup the database for
the tests.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Dbix-class mailing list