does import csv file support skip first row

487 views
Skip to first unread message

Chien-Yu Lai

unread,
Jun 5, 2018, 9:03:13 AM6/5/18
to Google Cloud SQL discuss
Hi team,

I have the csv(~ 1GB) file in cloud storage bucket, that was extracted from bigquery,
I'm trying to import the csv file form GCS to cloud sql,
used "SQLAdmin.v1beta4" api by java client library,
when data load into the cloud sql, that contains the first row,
have any function or api can skip the first row?  


the csv file like as
id,name,column1,column2
1,"name",1,1


the code like as
InstancesImportRequest requestBody = new InstancesImportRequest();
ImportContext importContext = new ImportContext();
importContext.setKind("sql#importContext");
importContext.setFileType("csv");
importContext.setUri("gs://bucket/2018/06/05/myfile.csv");
importContext.setDatabase("my_database");


ImportContext.CsvImportOptions csv = new ImportContext.CsvImportOptions();
csv.setTable("tableName");
importContext.setCsvImportOptions(csv);


requestBody.setImportContext(importContext);


SQLAdmin.Instances.SQLAdminImport request =
   sqlAdmin.instances().sqladminImport("my_project_id", "database_instance", requestBody);


Operation response = request.execute();


I wish I can skip the csv file first row maybe on "ImportContext.CsvImportOptions.skipFirstRow(true)",


Sorry, English is not my native language

Thanks in advance.
Regards,

Jordan (Cloud Platform Support)

unread,
Jun 5, 2018, 3:26:08 PM6/5/18
to Google Cloud SQL discuss
Since Google Groups is reserved for general product discussions, and not for feature requests, it is recommended to file this in the Public Issue Tracker. 

- Note that the Cloud SQL engineering team is already working on exposing all of the available MySQL options in csvImportOptions (where the 'IGNORE number LINES' option is equal to your requested skip first row option). There is no ETA at this time for a release. All further communications should occur in the feature request you open.  
Message has been deleted

Chien-Yu Lai

unread,
Jul 3, 2018, 6:42:01 AM7/3/18
to Google Cloud SQL discuss
Hi, Jordan
Thanks to your help


Jordan (Cloud Platform Support)於 2018年6月6日星期三 UTC+8上午3時26分08秒寫道:
Reply all
Reply to author
Forward
0 new messages