On Cloud SQL, with MySQL engine, how can I replace the functionality LOAD DATA INFILE ... REPLACE?
We are migrating our web platform to Google Cloud using App Engine and Cloud SQL.
We use LOAD DATA INFILE with either the mode IGNORE or REPLACE, to import CSV files into our tables.
Since the instruction LOAD DATA INFILE is not supported on Cloud SQL, how can we manage to replace it?
I have tried to use gcloud sql import csv and Cloud SQL API but it seems the option to IGNORE or REPLACE duplicate data is not present.
To give an example, here is the table in which the data is imported:
C1 | C2 | C3 | C4
-----------------
1 | 2 | 3 | A |
4 | 5 | 6 | B |
7 | 8 | 9 | C |
On this table there is a unique index on columns C1+C2+C3
Now I need to import a CSV file containing the following:
1,2,3,AA
If I used LOAD DATA INFILE with option REPLACE, the table after import would be like this:
C1 | C2 | C3 | C4
-----------------
1 | 2 | 3 | AA |
4 | 5 | 6 | B |
7 | 8 | 9 | C |
So, I would like to obtain the same behaviour on Cloud SQL with either gcloud sql import csv or Cloud SQL API.
We need to do this programmatically with PHP.
Is it possible or is there another possibility?
Thanks