[Dbix-class] Using sqlt with DBIx-Class schemas

Jess Robinson castaway at desert-island.demon.co.uk
Wed May 3 14:34:59 CEST 2006

Yes, but I'm using the SQLT from cvs, whic does have the package 
parameter.. SQLT has quite a slow release cycle, so I suggest you use 
that.. And Ill go poke the other devs, and see if we cant at least get 
some dev releases done.


On Mon, 1 May 2006, Matija Grabnar wrote:

> Ash Berlin wrote:
>> Matija Grabnar wrote:
>>> For a project (in Catalyst, if it matters) I wanted to write a
>>> DBIx::Class schema first, then use sqlt to translate that schema into
>>> appropriate SQL commands to create the database. (I considered doing it
>>> the other way, but I don't think sqlt would correctly pick up
>>> many-to-many relations automaticaly)
>>> However, I'm having a problem: sqlt refuses to parse my DBIx::Class schema.
>>> The error is:
>>> Error: translate: Error with parser 'DBIx::Class': Undefined subroutine
>>> &DBIx::Class::parse called at
>>> /usr/local/share/perl/5.8.8/SQL/Translator.pm line 484.
>>> When I run sqlt in debug mode, I see a difference between how the
>>> DBIx::Class producer (which works) and the parser (which doesn't work)
>>> get registered:
>> This was a problem i discovered and I thought Matt made a note of maybe
>> not. The problem is sqlt is pickup up DBIx::Class (as in the db access
>> module) before it picks up SQL::Translator::Parser::DBIx::Class. Perhaps
>> try the following (untested) cmd
>> sqlt -d -f SQL-Translator-Parser-DBIx-Class -t DBIx-Class-File
>> STest/Schema.pm
> Aha! That got me a few steps forward, but now I get:
> [SQL::Translator] Got parser: code ref
> [SQL::Translator] Got producer: code ref
> [SQL::Translator] Got parser: SQL::Translator::Parser::DBIx::Class::parse
> [SQL::Translator] Got producer:
> SQL::Translator::Producer::DBIx::Class::File::produce
> Error: translate: Error with parser
> 'SQL::Translator::Parser::DBIx::Class': No DBIx::Schema at
> /usr/local/share/perl/5.8.8/SQL/Translator/Parser/DBIx/Class.pm line 34.
> Looking at the code, I see that the parser expects to see the schema in the
>    my $dbixschema  = $args->{'DBIx::Schema'} || $data;
>    $dbixschema   ||= $args->{'package'};
> Going through sqlt with debugger, I see args being set up, but I don't
> see any way whatsoever of passing a "DBIx::Schema" or "package"
> parameter to the parser. I must be missing something.
> Is anybody using sqlt to translate DBIx::Class schemas into other stuff?
> If not, what are you using? And is, whatever you're using, able to
> specify the full range of DBIx::Class relationships, including many_to_many?
> _______________________________________________
> List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
> Wiki: http://dbix-class.shadowcatsystems.co.uk/
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/

More information about the Dbix-class mailing list