Re: CDBI::Loader and VIEWs

[prev] [thread] [next] [Date index for 2004/10/04]

From: Paul Makepeace
Subject: Re: CDBI::Loader and VIEWs
Date: 17:30 on 04 Oct 2004
Je 2004-10-04 17:11:27 +0100, Paul Makepeace skribis:
> Recently been using CDBI::Loader and was hoping to have it work with
> VIEWs. The problem seems to be that it's unable to derive PKs from the
> pg_catalog (which is reasonable since VIEWs don't have PKs :).
> 
> Has anyone come up with a workaround for this besides manually
> specifying one's views? Perhaps a primary key map to pass into
> CDBI::Loader (alongside e.g. namespace)? I've been toying around with
> this solution but it's more involved than I had suspected.

Just FYI, got this working now with patches to Class::DBI::Pg too,

  my $loader = Class::DBI::Loader->new(
          dsn => $config->{app_dbi_dsn},
          # etc
          primarykeys => {
                  my_view => qw/my_id/,
                  mcpk_view => [qw/mcpk_1_id mcpk_2_id/],
          },
  );

As I write this it occurs to me it might be nice to have overrides for
the various column grouping features too, so primarykeys in my example
could become Primary alongside e.g. Essential, Others, etc.

Seem reasonable?

Paul

        -- 
        Paul Makepeace .............................. http://paulm.com/inchoate/

"What is the day after yesterday? Writing on the left hand."
   -- http://paulm.com/toys/surrealism/

CDBI::Loader and VIEWs
Paul Makepeace 16:11 on 04 Oct 2004

Re: CDBI::Loader and VIEWs
Paul Makepeace 17:30 on 04 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52