Skip to main content

An asynchronous Postgres client and mixin for Tornado applications

Project description

An set of mixins and classes for interacting with PostgreSQL using asyncio in Tornado / sprockets.http applications using aiopg.

Version Build Status Coverage License

Installation

sprockets-postgres is available on the Python package index and is installable via pip:

pip install sprockets-postgres

Documentation

Documentation is available at sprockets-postgres.readthedocs.io.

Configuration

Configuration of sprockets-postgres is done by using of environment variables or tornado.web.Application.settings dictionary. The sprockets_postgres.ApplicationMixin will use configuration as applied to the settings dictionary, falling back to the environment variable if the value is not set in the dictionary. Keys in the settings dictionary are lowercase, and if provided as environment variables, are uppercase.

The following table details the available configuration options:

Variable

Definition

Type

Default

postgres_url

The PostgreSQL URL to connect to

str

postgres_max_pool_size

Maximum connection count to Postgres per backend

int

10

postgres_min_pool_size

Minimum or starting pool size.

int

1

postgres_connection_timeout

The maximum time in seconds to spend attempting to create a new connection.

int

10

postgres_connection_ttl

Time-to-life in seconds for a pooled connection.

int

300

postgres_query_timeout

Maximum execution time for a query in seconds.

int

60

postgres_hstore

Enable HSTORE support in the client.

bool

FALSE

postgres_json

Enable JSON support in the client.

bool

FALSE

postgres_uuid

Enable UUID support in the client.

bool

TRUE

If postgres_url uses a scheme of postgresql+srv, a SRV DNS lookup will be performed and the lowest priority record with the highest weight will be selected for connecting to Postgres.

AWS’s ECS service discovery does not follow the SRV standard, but creates SRV records. If postgres_url uses a scheme of aws+srv, a SRV DNS lookup will be performed and the URL will be constructed containing all host and port combinations in priority and weighted order, utilizing libpq’s supoprt for multiple hosts in a URL.

Requirements

Version History

Available at https://sprockets-postgres.readthedocs.org/en/latest/history.html

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

sprockets-postgres-1.8.1.tar.gz (11.8 kB view details)

Uploaded Source

File details

Details for the file sprockets-postgres-1.8.1.tar.gz.

File metadata

  • Download URL: sprockets-postgres-1.8.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

File hashes

Hashes for sprockets-postgres-1.8.1.tar.gz
Algorithm Hash digest
SHA256 b733043c5dffbec8406ccd1aaa1194a6e5b50ce8504b0587ebee0370352e1280
MD5 c8a8cf0d1df1accc5a26ab32e947c452
BLAKE2b-256 da9cc09a5bed54ddb28cab22cd2e25442f0de4cf746f38f2fbb662e60689a3b2

See more details on using hashes here.

Supported by

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