Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

dbicdump not importing the full table (Postgres)

by kiz (Monk)
on May 08, 2012 at 11:37 UTC ( #969425=perlquestion: print w/ replies, xml ) Need Help??
kiz has asked for the wisdom of the Perl Monks concerning the following question:

Environment - Perl: Ububtu 12.04; Perl 5.14.2; all packages installed via .debs. Database: postgres database on a Sun server.

I am using dbicdump to create a pile of DBIx::Class packages to access a database... and a few of tables are not coming through cleanly.

For example - If I query my database through psql, I get:

oarj3=> select column_name,data_type from information_schema.columns w +here table_name like 'urls'; column_name | data_type -----------------+------------------- date_checked | date http_code | integer base_uri | text host_alive | boolean last_check_good | boolean count_fails | integer count_success | integer pri | boolean url | text table_id | integer tbl | character varying id | integer (12 rows)

When I run the following dbicddump command

dbicdump -o dump_directory=./lib/perl -o debug=1 EDINA::ORI dbi:Pg:dbname=oarj3;host=[host];port=[port] [username] [password]

I get the following extract in Url.pm:

__PACKAGE__->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0, sequence => "urls_id_seq", }, "table", { accessor => undef, data_type => "varchar", is_nullable => 0, size +=> 20 }, "table_id", { data_type => "integer", is_nullable => 0 }, "url", { data_type => "text", is_nullable => 0 }, "primary", { data_type => "boolean", default_value => \"false", is_nullable => +0 }, );

First off.... the column "tbl" has become "table", and unaccessable - which is a bit of a problem, but easily solvable.

However the bigger problem is that I'm missing 7 columns!

The interesting part is that this is happening to my 'urls' table (12 rows), my 'name' table (drops the final "pri" column), and my 'org' table (8 rows: drops 6!), but not my 'repo' table (15 columns) or my 'sword' table (6 columns)

I've looked at the debug output, and it doesn't seem to be listing the columns:

EDINA::ORI::Result::Url->table("urls"); Column 'table' in table 'urls' collides with an inherited method. See "COLUMN ACCESSOR COLLISIONS" in perldoc DBIx::Class::Schema::Loade +r::Base . EDINA::ORI::Result::Url->add_columns( "id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0, sequence => "urls_id_seq", }, "table", { accessor => undef, data_type => "varchar", is_nullable => 0, size +=> 20 }, "table_id", { data_type => "integer", is_nullable => 0 }, "url", { data_type => "text", is_nullable => 0 }, "primary", { data_type => "boolean", default_value => \"false", is_nullable => +0 }, ); DBIx::Class::Schema::Loader::make_schema_at(): urls has no primary key + at /usr/local/bin/dbicdump line 178

Just to add confusion here - I've another database (same name) on a different postgres server (different port), and I know it's not being referenced as it has different fields in its tables, and they're not being imported.

I've looked and looked, rerun and compared, and even spoken to a teddybear.... Other than hand-coding the missing data into the records, is there something I've missed?

Is there an obvious reason the data is not being build correctly?



-- Ian Stuart
A man depriving some poor village, somewhere, of a first-class idiot.

Comment on dbicdump not importing the full table (Postgres)
Select or Download Code
Re: dbicdump not importing the full table (Postgres)
by Anonymous Monk on May 08, 2012 at 11:49 UTC

      the sqlt test suite is good :)

      Create table schema manually from description

      and sqlt doesn't appear to miss anything either

      output from sqlt -f PostgreSQL -t DBIx::Class::File --prefix=EDINA::ORI < in > out

      Is this a bug in dbicdump ? I can't tell :)

      dbicdump: Hmmm - Ubuntu has packaged 0.07010, and CPAN has 0.07023... I'll have a look at the changes file!

      pg_dump: I've removed a pile of PostGIS stuff from this (I think I got it all....)

      Hmmmm... the plot thickens!

      W did some testing with a colleague, who had got good results when he demonstrated the advantage of Catalyst to me.

      • He's running Perl 5.12, I'm on 5.14
      • We are running the same version of catalyst
      • He's running DBIx::Class::Schema::Loader 0.07017, I went from 0.07020 to 0.07023

      I have rolled back to ::::Loader 0.07017, and I'm no longer getting errors.

      I would class this as a bug, and will report it back.

      Thankee for your time, and attention.



      -- Ian Stuart
      A man depriving some poor village, somewhere, of a first-class idiot.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://969425]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-08-20 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (106 votes), past polls