[Dbix-class] RFC: Load from SQL

Jeff Zucker jeff at vpservices.com
Tue Jul 10 23:51:05 GMT 2007


Brandon Black wrote:
> On 7/10/07, Jeff Zucker <jeff at vpservices.com> wrote:
>> Brandon Black wrote:
>> Eventutally I can make the DBDs
>> store their DDL so that the metadata will be saved (in a schema.cfg file
>> or some such) but that's too much work for summetime :-).
>>
>
> If you want to make Schema::Loader::SQLT, by all means go ahead, and
> we'll put it in the main distro, I just think the DBI metadata route
> is better in the long term.
>
Agreed.
> On the other hand, if you were to put this extra DDL parsing into
> DBD::CSV itself when the CREATE TABLEs are executed (and again, it
> might be possible to offload most of it to SQLT, and make it optional
> for those that don't care via an extra connect() attribute), store the
> extra metadata in the driver handle, and support querying it via the
> standard DBI metadata methods, Schema::Loader would automatically
> support you, and all kinds of other modules could use the info too
Yes, that's what I meant when I was talking about a schema.cfg file - 
parse the CREATE statement with SQL::T and store it as a config that 
could be loaded with the table and then used to support DBI column_info, 
etc.  It's something I've had on my to-do list for at least a year.

The problem is that there are about a dozen DBDs involved (DBD::DBM, 
DBD::Amazon, DBD::Excel, DBD::Gopher, etc.) and while they all subclass 
SQL::Statement, they don't all subclass DBD::File which is where the 
storage mostly happens.  The other issue is that they each have a 
different relations of schemas, tables, and files - e.g. AnyData::XML 
can use XML::Twig to treat a single file as either a table or as a 
schema containing many tables same with DBD::Excel and multiple 
worksheets per file.  And what exactly is a table or a schema in 
DBD::Amazon ? :-)  I'm open to any suggestions you might have on those 
kinds of issues.  I'm also open to an army of elves helping this old 
cobbler in the night.  Happen to know of such an army?  :-) Patches and 
collaborators are most definitely welcome.

-- 
Jeff






More information about the Dbix-class mailing list