Data import problem with duplicate datasets
am 23.09.2009 09:22:18 von 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=gcdmg-mysql-2@m.gmane.org
Re: Data import problem with duplicate datasets
am 23.09.2009 09:53:53 von Claudio Nanni - TomTom
--00c09ffb4c5f2bce2904743a04c7
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
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 i=
s
> 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 i=
n
> 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=3Dclaudio.nanni@gmail.com
>
>
--=20
Claudio
--00c09ffb4c5f2bce2904743a04c7--