Thursday, May 28, 2020

[google-cloud-sql-discuss] Re: Export Cloud SQL data into a CSV, including headers and adding a custom delimiter

Hello,
Thanks for your answer! In regards with the query, I can not just do the query:
SELECT <query> INTO OUTFILE ... CHARACTER SET 'utf8mb4'
        FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\"'
        ESCAPED BY '\\' LINES TERMINATED BY '\n'
Because I am accessing the resources via the REST API and if I exchange the  string parameter from:
  "csvExportOptions": {
    "selectQuery": string
  }
with the specified query the  FIELDS TERMINATED BY ','  is actually begin discarded.
In regards with the include headers I saw that solution, but that solution always means that you are aware of the column names and always change them when they change in the database. I was searching for a more automated method one that can get the column names without specifically mentioning them. Basically I wanted to tun something like: "SELECT * FROM table_name" and get data and column names.

Thank you! 

--
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/247f14db-27ac-425b-b8fb-5853408e2d5f%40googlegroups.com.

No comments:

Post a Comment