Re: Data import problem with duplicate datasets

2009-09-23 Thread Claudio Nanni
A very first thought I got is disable the constraint before import and
re-enable after that.
One way could be to set the foreign key checks to false or alter the
constraint and remove the 'cascade delete' part.
It's just a quick brain storm, please verify the goodness of it, I still
need to get my coffee this morning!

Claudio


2009/9/23 

> Hello,
>
> we have two tables associated with a foreign key constraint.
> Table A with the primary key and table B with an "on delete cascade"
> constraint.
> We want to delete datasets in Table B if the related dataset in Table A is
> deleted - that works.
>
> Now the Problem:
> There is a weekly import defined on table A using a "load data infile
>  replace into table A" command.
> The problem is the implicit delete/insert from the replace keyword.
> Therefore the sets in Table B are deleted.
> We are using replace because some datasets have to be modified in some
> columns in table A.
>
> Is there a possibility to avoid the delete in Table B by importing data in
> Table A?
>
>
> Regards,
> Spiker
> --
> Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
> für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=claudio.na...@gmail.com
>
>


-- 
Claudio


Data import problem with duplicate datasets

2009-09-23 Thread spikerlion
Hello,

we have two tables associated with a foreign key constraint.
Table A with the primary key and table B with an "on delete cascade" constraint.
We want to delete datasets in Table B if the related dataset in Table A is 
deleted - that works.

Now the Problem:
There is a weekly import defined on table A using a "load data infile  
replace into table A" command.
The problem is the implicit delete/insert from the replace keyword. Therefore 
the sets in Table B are deleted.
We are using replace because some datasets have to be modified in some columns 
in table A.

Is there a possibility to avoid the delete in Table B by importing data in 
Table A?


Regards,
Spiker
-- 
Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org