将数据从VisioNature网站传输到PostgreSQL数据库
Client-API-VN的Python项目详细描述
从Biolovision/VisoNature传输数据的Python应用程序 网站并将其存储到PostgreSQL数据库中。
说明
开始
创建一个python虚拟环境,激活它并更新基本工具:
python3 -m venv VN_env source VN_env/bin/activate python -m pip install --upgrade pip
从pypi安装:
pip install Client-API-VN
在主目录中初始化示例YAML文件并使用编辑 您的本地详细信息:
transfer_vn --init .evn_your_site.yaml editor $HOME/.evn_your_site.yaml
然后可以下载数据,如yaml文件中所启用的那样。 注意,根据观察的数量, 这可能需要几个小时。我们建议首先从一个小的分类组开始:
transfer_vn --db_create --json_tables_create --col_tables_create --full .evn_your_site.yaml
完成此操作后,您可以使用新的观察结果更新数据库:
transfer_vn --update .evn_your_site.yaml
注意:这个脚本应该在cron作业中每小时或每天运行一次。 它必须至少每周运行一次。
先决条件
安装需要以下python模块:
pip
所有其他依赖项都由pip install管理
运行应用程序
应用程序运行方式:
transfer_vn options file
其中:
- 下面介绍的选项命令行选项
- 文件yaml file,位于$home目录中,如示例文件所述
命令行选项
-h, --help | Prints help and exits |
--version | Print version number |
-v, --verbose | Increase output verbosity |
-q, --quiet | Reduce output verbosity |
--init | Initialize the YAML configuration file |
--db_drop | Delete if exists database and roles |
--db_create | Create database and roles |
--json_tables_create | |
Create or recreate json tables | |
--col_tables_create | |
Create or recreate colums based tables | |
--full | Perform a full download |
--update | Perform an incremental download |
--count | Count observations by site and taxo_group |
--profile | Gather and print profiling times |
注意
此项目是使用PyScaffold 3.1设置的详细信息和用法 有关pyscaffold的信息,请参见https://pyscaffold.org/。