gino-starlette
Introduction
An extension for GINO to support starlette server.
Usage
The common usage looks like this:
from starlette.applications import Starlette
from gino.ext.starlette import Gino
app = Starlette()
db = Gino(app, **kwargs)
Configuration
GINO adds a middleware to the Starlette app to setup and cleanup database according to
the configurations that passed in the kwargs parameter.
The config includes:
| Name | Description | Default |
|---|---|---|
driver |
the database driver | asyncpg |
host |
database server host | localhost |
port |
database server port | 5432 |
user |
database server user | postgres |
password |
database server password | empty |
database |
database name | postgres |
dsn |
a SQLAlchemy database URL to create the engine, its existence will replace all previous connect arguments. | N/A |
retry_times |
the retry times when database failed to connect | 20 |
retry_interval |
the interval in seconds between each time of retry | 5 |
pool_min_size |
the initial number of connections of the db pool. | N/A |
pool_max_size |
the maximum number of connections in the db pool. | N/A |
echo |
enable SQLAlchemy echo mode. | N/A |
ssl |
SSL context passed to asyncpg.connect |
None |
use_connection_for_request |
flag to set up lazy connection for requests. | N/A |
retry_limit |
the number of retries to connect to the database on start up. | 1 |
retry_interval |
seconds to wait between retries. | 1 |
kwargs |
other parameters passed to the specified dialects, like asyncpg. Unrecognized parameters will cause exceptions. |
N/A |
Lazy Connection
If use_connection_for_request is set to be True, then a lazy connection is available
at request['connection']. By default, a database connection is borrowed on the first
query, shared in the same execution context, and returned to the pool on response.
If you need to release the connection early in the middle to do some long-running tasks,
you can simply do this:
await request['connection'].release(permanent=False)
Metadata
Release files for gino-starlette 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gino_starlette-0.1.6.tar.gz | 5.7 kB | Without provenance | Details for gino_starlette-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gino_starlette-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for gino_starlette-0.1.6-py3-none-any.whl |
Total release size: 11.8 kB
Release files / gino_starlette-0.1.6.tar.gz
| Download URL | gino_starlette-0.1.6.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16321616e17c0c8f6f8092630938e90479aed9ae63cff4311ded9fbd17b4e454
|
|
BLAKE2b-256 checksum How to use checksums |
8efbe60d828ec11c1ccd859708d1a32f1cfc1deef0f1a169a3ad3eb9c53b4937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.15 Linux/5.15.0-1030-azure
|
Release files / gino_starlette-0.1.6-py3-none-any.whl
| Download URL | gino_starlette-0.1.6-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b2042c710bb65b5e4bc505d4b5c678ba41a5ba8a9e91136c03c7332cd638570
|
|
BLAKE2b-256 checksum How to use checksums |
fdaf5af7ab27d110950f1eeaafeed429db177c303074bf9f15af82c6ed2e828e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.8.15 Linux/5.15.0-1030-azure
|
Security for gino-starlette 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.