Saturday, February 12, 2022

[google-cloud-sql-discuss] Problem with importContext always import csv header

I have a csv file with a header, whenever I import the csv, the header is imported as one more record in the table

uri = "gs://mybucket/backup/mysql-000000000000.csv"          
            body = {
                "importContext": {
                    "kind": "sql#importContext",
                    "fileType": "CSV",
                    "uri": uri,
                    "database": 'mydbname',
                    "csvImportOptions": {
                        "table": 'mytable'
                    }
                }
            }
            request = self.service_sql.instances().import_(project='myproject', instance='myinstance', body=body)
            response = request.execute()

Is there a way to import the csv without header using any option? or I should pass the csv without header?

Thank

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/1dcd15cc-6531-45aa-9290-c5edf704f8d2n%40googlegroups.com.

No comments:

Post a Comment