python cli将整个cartodb域备份到sql转储文件(zipped)。可选地,您可以将SQL转储文件恢复到新的(创建的)PASGIS数据库。还可以将SQL文件上传到Amazon S3。
cartodb_backup的Python项目详细描述
python cli将整个cartodb域备份到sql转储文件 (拉链)。
可选:
- 可以将sql转储文件还原到新的(创建的)postgis数据库。
- 您可以将sql文件上传到amazon s3。
- 来自amazon sns(简单通知服务)的消息。
在执行这个脚本之前,您需要一个cartdbkconfig.py文件 形成(见cartdbkconfig_example.py)。
cartdbkconfig.py配置参数:
confparams={"cdb_apikey":"here your api key","cdb_domain":"here your domain","sql_folderpath":"here your dump folderpath","pg_user":"here your db admin user","pg_pswd":None,# If you leave the password to None, the program will ask you in the command line interface"pg_dbase":"here your db name","pg_host":"here your db host","pg_port":"here your db port","pg_newdatabase":"here your new db name","aws_acckey":"here your AWS Acces Key","aws_seckey":"here your AWS Secret Key","aws_bucket":"here your AWS bucket","aws_prekey":"here your AWS bucket prefix key","sns_regname":"here your AWS region name","sns_arn":"here your SNS ARN","sns_subject":"My project"}
安装
您可以从pypi安装此软件包: https://pypi.python.org/pypi/cartodb_backup
$ pip install cartodb_backup
您也可以这样安装:
$ python setup.py install
用法
python客户端:
$ cartodb_backup [-h] configfile [--postgis_backup][--aws_s3upload][--amz_sns][--rmv_localfl] positional arguments: configfile Config filepath: /folderlocation/ optional arguments: -h, --help show this help message and exit --postgis_backup POSTGIS_BACKUP PostGIS backup (restoring dump file created) --aws_s3upload Upload file to Amazon S3 --amz_sns Amazon SNS message --rmv_localfl Remove local file after a successfully Amazon S3 upload
不带Postgis备份的示例:
$ cartodb_backup /folderlocation/
Postgis备份示例:
$ cartodb_backup /folderlocation/ --postgis_backup
亚马逊S3上传示例:
$ cartodb_backup /folderlocation/ --aws_s3upload
Amazon S3 Upload和Amazon SNS的示例(删除本地SQL文件夹 上传后:
$ cartodb_backup /folderlocation/ --aws_s3upload --amz_sns --rmv_localfl
要求
- 格达尔=1.11。
- PostgreSQL与Postgis(1)。
- psycopg2 python库(1)。
- 与amazon web服务(boto)的python接口(2)。
- 仅当您想使用–postgis_backup参数时。
- 仅当您想使用–aws_s3upload参数时。
许可证
这个程序是免费软件;你可以重新发布和/或修改它 根据 自由软件基金会;许可证的版本2,或者 选项)任何更高版本。