[Dbix-class] arbitrary table names - best practice?

John Napiorkowski jjn1056 at yahoo.com
Tue May 13 02:17:41 BST 2008


--- On Mon, 5/12/08, James Kiser <james.kiser at gmail.com> wrote:

> From: James Kiser <james.kiser at gmail.com>
> Subject: [Dbix-class] arbitrary table names - best practice?
> To: dbix-class at lists.scsys.co.uk
> Date: Monday, May 12, 2008, 8:51 PM
> I have a database that contains a few thousand tables that
> all share
> the same structure.  They are all named as
> [db].[table][unique
> number].  The unique number is basically the primary key to
> another
> table which is used to define the 'relationship'.
> 
> Obviously, I don't want to create a class for each
> table and would
> ideally like to have one class that will dynamically use
> the
> appropriate table based on the primary key (unique number)
> that I
> have.  The right answer is to redesign the schema and there
> are plans
> to do this.  However, I need a solution I can work with
> until those
> changes take place.
> 
> I have a working solution based off of
> DBIx::Class::Schema::Loader
> using the constraint option.  Is using
> DBIx::Class::Schema::Loader the
> *best way* to handle this situation?  Has anyone else had
> to implement
> something similar?  Are there any other alternatives?
> 
> Thanks in advance,
> James
> 

I'm not sure if there is a better way to do this, but I'd sure like to see an article/blog/something about you using Perl and DBIC to deal with a DB with a few thousand tables.  I wonder if Rails/ActiveRecord could even come close to starting up under such conditions :)

Good Luck,
John

> _______________________________________________
> List:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive:
> http://www.grokbase.com/group/dbix-class@lists.rawmode.org


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



More information about the DBIx-Class mailing list