Skip to main content

Fixture to bring up temporary pgbouncer instance.

Project description

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 provides a python interface to setup and run a pgbouncer instance.

Dependencies

Testing Dependencies

In addition to the above, the tests also depend on:

Usage

Create a PGBouncerFixture - a context manager with an extended protocol supporting access to logs etc. Customise it with database definitions, user credentials, and then when you enter the context it will create a transient pgbouncer setup in a temporary directory and run it for the duration that the context is open.

For instance:

>>> 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

Any settings required for pgbouncer to work will be given sane defaults.

Installation

Either run setup.py in an environment with all the dependencies available, or add the working directory to your PYTHONPATH.

Development

Upstream development takes place at https://launchpad.net/python-pgbouncer.

To run the tests, run:

$ tox

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pgbouncer-0.2.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pgbouncer-0.2.0-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

Details for the file pgbouncer-0.2.0.tar.gz.

File metadata

  • Download URL: pgbouncer-0.2.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pgbouncer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3548a7d5db3ff6a73d85c3f554e640005dd973ce3fb03fad749589d7318f5fd9
MD5 fef434701e83191a66437ea89d6a0ea6
BLAKE2b-256 afd16b3ea6f8b89f91f482d3165509a48cf0a927cc1910da3565bd4632b14615

See more details on using hashes here.

File details

Details for the file pgbouncer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pgbouncer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pgbouncer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ca2facf45fe743156256b8b76b0b65da28dbd24adad8d373d2c9b409c30ba47
MD5 bdb1d790cfe3a494e37b824ed89294c0
BLAKE2b-256 4e297cb2b8269a4f15134810b0b949b303c73e59ad08c3036440054cd4ce3675

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page