Reputation: 71
I have data in GCP Cloud SQL PostgreSQL, I want to export this data into GCS in Parquet format, I see that it's not possible directly, only I can do in SQL and CSV format, anyways for exporting the data in Parquet format.
Upvotes: 3
Views: 2500
Reputation: 75735
I propose you to achieve this through BigQuery
CREATE TABLE my_dataset.temp_table AS
SELECT * FROM EXTERNAL_QUERY("project_id.region.connection_name", "SELECT * FROM .....;");
bq --location=region extract \
--destination_format parquet \
project_id:my_dataset.temp_table \
gs://bucket/filename.parquet
This way guaranty you only one file (or a small number of sharded file.
However you can speed up the process, but this solution can generate an higher number of file
EXPORT DATA OPTIONS(
uri='gs://bucket/filename.parquet*',
format='PARQUET') AS
SELECT * FROM EXTERNAL_QUERY("project_id.region.connection_name", "SELECT * FROM .....;");
https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement
Upvotes: 4