简体   繁体   English

Python function 到 pg_restore 谷歌云 SQL 数据库

[英]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_dumpC 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_dumpC 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.

相关问题 从 python 调用 pg_restore - Call pg_restore from python 使用 python 模块子进程的 pg_dump & pg_restore 密码 - pg_dump & pg_restore password using python module subprocess 在转储文件上使用pg_restore - Using pg_restore on dump file 有没有一种方法可以使用pg_restore自动解压缩? - Is there a way to unzip automatically with pg_restore? pg_restore:错误:尝试将 postgres 数据库导入到 heroku 时搜索存档时无法识别的数据块类型 (0) - pg_restore: error: unrecognized data block type (0) while searching archive while trying to import postgres database to heroku 如何在Windows命令行上使用pg_restore? - How to use pg_restore on Windows Command Line? 如何使用 Python 运行时从 Google Cloud Function 访问非 Google MySQL 服务器数据库(无 Cloud SQL!) - How to access a non-Google MySQL server database (no Cloud SQL!) from Google Cloud Function in Python runtime using SQLAlchemy 不同服务器之间的 pg_dump 和 pg_restore 具有对要转储的数据的选择标准 - pg_dump and pg_restore between different servers with a selection criteria on the data to be dumped 使用 Python 和 SQLAlchemy 从谷歌云 Function 连接到云 SQL - Connecting to Cloud SQL from Google Cloud Function using Python and SQLAlchemy 如何更改列的顺序,使其不会破坏 pg_restore 的导入 - How to I change the order of my columns so it doesn't break an import with pg_restore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM