启动临时pgbouncer实例的装置。
pgbouncer的Python项目详细描述
Copyright (c) 2011, Canonical Ltd
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
python pgbouncer提供了一个python接口来设置和运行pgbouncer 实例。
依赖关系
- Python2.6+
- 保镖
- python fixtures(https://launchpad.net/python-fixtures或 https://pypi.org/project/fixtures)
- 测试工具(https://pypi.org/project/testtools)
测试依赖项
除上述内容外,测试还取决于:
用法
创建pgbouncerfixture-一个具有扩展协议的上下文管理器 支持访问日志等。使用数据库定义、用户自定义 凭证,然后当您进入上下文时,它将创建一个瞬态 在临时目录中安装pgbouncer,并在 上下文已打开。
例如:
>>> from pgbouncer import PGBouncerFixture >>> bouncer = PGBouncerFixture() >>> bouncer.databases['mydb'] = 'host=hostname dbname=foo' >>> bouncer.users['user1'] = 'credentials' >>> with bouncer: ... # Can now connect to bouncer.host port=bouncer.port user=user1
pgbouncer工作所需的任何设置都将被赋予正常的默认值。
安装
在具有所有可用依赖项的环境中运行setup.py,或者 将工作目录添加到pythonpath。