Reputation: 512
I have a table in bigquery that I want to continuously replicate into a google cloud postgres table and be able to query it from the postgres instance. What is the easiest way to do this? I am hoping to create a cronjob to run a query to create the table in postgres
Something like....
CREATE OR REPLACE TABLE postgres_server.table123 as select * from bigquery.table123;
Is this possible?
Upvotes: 0
Views: 695
Reputation: 142
I don't think there is a direct way to do this replicate between Bigquery and Cloud SQL.
To copy data from Big query to Cloud SQL one option I could think of is Export/Import:
Sample Copy Command which we can run from VM(VM instance to have access to GCS bucket Source and Target Post Gres): gsutil cat gs://<bucket_name>/<csv_filename> | psql -h <CLOUDSQL_IP> -d -U -c "\copy from stdin with (format csv)"
[1] https://cloud.google.com/bigquery/docs/exporting-data [2] https://www.postgresql.org/docs/13/sql-copy.html
Upvotes: 1