Mailing List Archive

Using soap to clone a story
I am trying this soap command to clone a bunch of stories to a new category, but it says there is a SQL error. Can anyone tell me what I am doing wrong, or if there is a better way to do this?

bricolage/bin/bric_soap story list_ids --search uri="/louisville/%" | bricolage/bin/bric_soap story export - | sed -e 's/\/louisville\//\/cincinnati\//' | bricolage/bin/bric_soap story create -

Output:
Call to Bric::SOAP::Story->create failed:

Unable to execute SQL statement

Check the Apache error log for more detail.

Output of the Apache error log:
[Wed Sep 16 23:06:16 2009] [error] SOAP::Serializer::envelope: Server Application error Unable to execute SQL statement: DBD::Pg::st execute failed: ERROR: new row for relation "story" violates check constraint "ck_story__publish_status" [.for Statement "INSERT INTO story (id, uuid, priority, source__id, usr__id, element_type__id, first_publish_date, publish_date, expire_date, current_version, published_version, workflow__id, publish_status, primary_uri, active, desk__id, site__id, alias_id) VALUES (NEXTVAL('seq_story'), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" with ParamValues: 1='8e95d088-cb1a-4312-b902-dee2917e4fbb', 2='3', 3='1025', 4='1027', 5='1061', 6='2009-06-05 22:11:31.000000', 7='2009-09-14 15:44:23.000000', 8=undef, 9='0', 10=undef, 11='0', 12='0', 13='/cincinnati/index.php', 14='0', 15='0', 16='1224', 17=undef] at /usr/local/bricolage/lib/Bric/Util/DBI.pm line 1136, <GEN250> line 28.\n\n[/usr/local/bricolage/lib/Bric/Util/DBI.pm:1137]\n[/usr/local/bricolage/lib/Bric/Biz/Asset/Business/Story.pm:2328]\n[/usr/local/bricolage/lib/Bric/Biz/Asset/Business/Story.pm:1900]\n[/usr/local/bricolage/lib/Bric/SOAP/Story.pm:1032]\n[/usr/local/bricolage/lib/Bric/SOAP/Asset.pm:246]\n[/usr/share/perl5/SOAP/Lite.pm:2744]\n[/usr/share/perl5/SOAP/Transport/HTTP.pm:394]\n[/usr/share/perl5/SOAP/Transport/HTTP.pm:717]\n[/usr/local/bricolage/lib/Bric/SOAP/Handler.pm:175]\n[-e:0]
[/usr/local/bricolage/lib/Bric/SOAP/Handler.pm:256]
[/usr/share/perl5/SOAP/Lite.pm:2838]
[/usr/share/perl5/SOAP/Lite.pm:1550]
[/usr/share/perl5/SOAP/Lite.pm:746]
[/usr/share/perl5/SOAP/Lite.pm:2802]
[/usr/share/perl5/SOAP/Transport/HTTP.pm:406]
[/usr/share/perl5/SOAP/Lite.pm:2795]
[/usr/share/perl5/SOAP/Transport/HTTP.pm:394]
[/usr/share/perl5/SOAP/Transport/HTTP.pm:717]
[/usr/local/bricolage/lib/Bric/SOAP/Handler.pm:175]
[-e:0]
Re: Using soap to clone a story [ In reply to ]
Hi Adam,

If the story list includes things that have already been published, you'll
need a few more sed pipes to change publish_status to 0 and strip out
publish date (I forget OTOH, maybe just publish_date or
first_publish_date?)

--Greg

On Wed, 16 Sep 2009 19:08:35 -0400, Adam Wilson <adam@RFXTechnologies.com>
wrote:
> I am trying this soap command to clone a bunch of stories to a new
> category, but it says there is a SQL error. Can anyone tell me what I am
> doing wrong, or if there is a better way to do this?
>
> bricolage/bin/bric_soap story list_ids --search uri="/louisville/%" |
> bricolage/bin/bric_soap story export - | sed -e
> 's/\/louisville\//\/cincinnati\//' | bricolage/bin/bric_soap story
create
Re: Using soap to clone a story [ In reply to ]
The other approach is to export, then run a little script (for all the
category changes/publish date removals/etc) against the XML, and then
import using the tidied-up XML.

This involves a little more manual labour, but it's much easier to spot
the troubles where they pop up.

Cheers,

Bret


On Wed, 2009-09-16 at 17:26 -0700, Greg Heo wrote:
> Hi Adam,
>
> If the story list includes things that have already been published, you'll
> need a few more sed pipes to change publish_status to 0 and strip out
> publish date (I forget OTOH, maybe just publish_date or
> first_publish_date?)
>
> --Greg
>
> On Wed, 16 Sep 2009 19:08:35 -0400, Adam Wilson <adam@RFXTechnologies.com>
> wrote:
> > I am trying this soap command to clone a bunch of stories to a new
> > category, but it says there is a SQL error. Can anyone tell me what I am
> > doing wrong, or if there is a better way to do this?
> >
> > bricolage/bin/bric_soap story list_ids --search uri="/louisville/%" |
> > bricolage/bin/bric_soap story export - | sed -e
> > 's/\/louisville\//\/cincinnati\//' | bricolage/bin/bric_soap story
> create
>
>
--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com
RE: Using soap to clone a story [ In reply to ]
Greg was right about my immediate problem, and I ended up using Bret's idea because I had other things I needed to remedy as well.

Thank you both for your assistance.

-----Original Message-----
From: Bret Dawson [mailto:bret@pectopah.com]
Sent: Wednesday, September 16, 2009 9:19 PM
To: devel@lists.bricolage.cc
Subject: Re: Using soap to clone a story

The other approach is to export, then run a little script (for all the
category changes/publish date removals/etc) against the XML, and then
import using the tidied-up XML.

This involves a little more manual labour, but it's much easier to spot
the troubles where they pop up.

Cheers,

Bret


On Wed, 2009-09-16 at 17:26 -0700, Greg Heo wrote:
> Hi Adam,
>
> If the story list includes things that have already been published, you'll
> need a few more sed pipes to change publish_status to 0 and strip out
> publish date (I forget OTOH, maybe just publish_date or
> first_publish_date?)
>
> --Greg
>
> On Wed, 16 Sep 2009 19:08:35 -0400, Adam Wilson <adam@RFXTechnologies.com>
> wrote:
> > I am trying this soap command to clone a bunch of stories to a new
> > category, but it says there is a SQL error. Can anyone tell me what I am
> > doing wrong, or if there is a better way to do this?
> >
> > bricolage/bin/bric_soap story list_ids --search uri="/louisville/%" |
> > bricolage/bin/bric_soap story export - | sed -e
> > 's/\/louisville\//\/cincinnati\//' | bricolage/bin/bric_soap story
> create
>
>
--
Bret Dawson
Producer
Pectopah Productions Inc.
(416) 895-7635
bret@pectopah.com
www.pectopah.com