I have a CSV file on a Cloud Storage instance (bd_storage) and need to make an import to an already created table (matriculas) in a Cloud SQL database (test). The thing is that the UI import option by default use fields separated by comma (',') and my CSV file is semicolon separated (';').
I know I could use a text editor to change all the commas to semicolons, but the CSV file it's too big for my PC to do it (that's the reason I'm using Google Cloud Platform). How can I use the Cloud Shell to do that?
Here are some examples of what I've tried with no success:
NOTE: I login using gcloud sql connect mschiaff --user=root
, and then use test
to specify the database, where 'mschiaff' it's the Cloud SQL instance.
LOAD DATA LOCAL INFILE 'gs://bd_storage/Matrícula_Ed_Superior_2016_UPLOAD.csv' INTO TABLE `matriculas` CHARACTER SET 'utf8' FIELDS TERMINATED BY ';';
Error:
2 (HY000): File 'gs:/bd_storage/Matrícula_Ed_Superior_2016_UPLOAD.csv' not found (Errcode: 2 "No such file or directory")
LOAD DATA INFILE 'gs://bd_storage/Matrícula_Ed_Superior_2016_UPLOAD.csv' INTO TABLE `matriculas` CHARACTER SET 'utf8' FIELDS TERMINATED BY ';';
Error:
ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)
This is for my thesis.