[英]Python function to pg_restore a Google Cloud SQL database
Every day I do a pg_dump
of my locally hosted PostgreSQL
database and store that file in a Google Cloud Storage
bucket.每天我都会对本地托管的
PostgreSQL
数据库进行pg_dump
操作,并将该文件存储在Google Cloud Storage
桶中。 There is only ever one file stored in the bucket and it is the most recent pg_dump
.存储桶中只存储一个文件,它是最新的
pg_dump
。 The pg_dump
is a C Source
file type. pg_dump
是C Source
文件类型。
I am now looking to write a python
function that can access that pg_dump
file stored in the Google Cloud Storage
bucket and use it to do a pg_restore
on a PostgreSQL
database that lives on a Google Cloud SQL
instance. I am now looking to write a
python
function that can access that pg_dump
file stored in the Google Cloud Storage
bucket and use it to do a pg_restore
on a PostgreSQL
database that lives on a Google Cloud SQL
instance. The purpose of this is to have my local database essentially be backed up to a Google Cloud SQL
instance.这样做的目的是让我的本地数据库基本上备份到
Google Cloud SQL
实例。 I cannot even figure out where to start on this python
function.我什至不知道从哪里开始这个
python
function。
Every day I do a pg_dump
of my locally hosted PostgreSQL
database and store that file in a Google Cloud Storage
bucket.每天我都会对本地托管的
PostgreSQL
数据库进行pg_dump
操作,并将该文件存储在Google Cloud Storage
桶中。 There is only ever one file stored in the bucket and it is the most recent pg_dump
.存储桶中只存储一个文件,它是最新的
pg_dump
。 The pg_dump
is a C Source
file type. pg_dump
是C Source
文件类型。
I am now looking to write a python
function that can access that pg_dump
file stored in the Google Cloud Storage
bucket and use it to do a pg_restore
on a PostgreSQL
database that lives on a Google Cloud SQL
instance. I am now looking to write a
python
function that can access that pg_dump
file stored in the Google Cloud Storage
bucket and use it to do a pg_restore
on a PostgreSQL
database that lives on a Google Cloud SQL
instance. The purpose of this is to have my local database essentially be backed up to a Google Cloud SQL
instance.这样做的目的是让我的本地数据库基本上备份到
Google Cloud SQL
实例。 I cannot even figure out where to start on this python
function.我什至不知道从哪里开始这个
python
function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.