All Projects → python-gino → gino-starlette

python-gino / gino-starlette

Licence: other
An extension for GINO to support Starlette server.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to gino-starlette

fastapi-zeit-now
A simple example of deploying FastAPI as a Zeit Serverless Function
Stars: ✭ 24 (-67.57%)
Mutual labels:  starlette
pytorch-serving
[UNMAINTAINED] A starter pack for creating a lightweight responsive web app for Fast.AI PyTorch models.
Stars: ✭ 16 (-78.38%)
Mutual labels:  starlette
pait
Python Modern API Tools, fast to code
Stars: ✭ 24 (-67.57%)
Mutual labels:  starlette
serverless-mangum-examples
Example ASGI applications and Serverless Framework configurations using Mangum
Stars: ✭ 26 (-64.86%)
Mutual labels:  starlette
fastapi-tdd-docker
Test-Driven Development with FastAPI and Docker
Stars: ✭ 89 (+20.27%)
Mutual labels:  starlette
starlette-discord
"Login with Discord" support for Starlette and FastAPI
Stars: ✭ 15 (-79.73%)
Mutual labels:  starlette
arel
Lightweight browser hot reload for Python ASGI web apps
Stars: ✭ 69 (-6.76%)
Mutual labels:  starlette
async-asgi-testclient
A framework-agnostic library for testing ASGI web applications
Stars: ✭ 123 (+66.22%)
Mutual labels:  starlette
python-in-browser
🐍🛥🌟 Running Python in the browser with Batavia and Starlette
Stars: ✭ 12 (-83.78%)
Mutual labels:  starlette
Awesome Fastapi
A curated list of awesome things related to FastAPI
Stars: ✭ 3,033 (+3998.65%)
Mutual labels:  starlette
msgpack-asgi
Drop-in MessagePack support for ASGI applications and frameworks
Stars: ✭ 100 (+35.14%)
Mutual labels:  starlette
aiodogstatsd
An asyncio-based client for sending metrics to StatsD with support of DogStatsD extension
Stars: ✭ 26 (-64.86%)
Mutual labels:  starlette
starlette-graphene3
An ASGI app for using Graphene v3 with Starlette / FastAPI
Stars: ✭ 52 (-29.73%)
Mutual labels:  starlette
fastapi-users
Ready-to-use and customizable users management for FastAPI
Stars: ✭ 1,920 (+2494.59%)
Mutual labels:  starlette
starlette-context
Middleware for Starlette that allows you to store and access the context data of a request. Can be used with logging so logs automatically use request headers such as x-request-id or x-correlation-id.
Stars: ✭ 320 (+332.43%)
Mutual labels:  starlette
spectree
API spec validator and OpenAPI document generator for Python web frameworks.
Stars: ✭ 190 (+156.76%)
Mutual labels:  starlette
webargs-starlette
Declarative request parsing and validation for Starlette with webargs
Stars: ✭ 36 (-51.35%)
Mutual labels:  starlette
starlite
Light, Flexible and Extensible ASGI API framework
Stars: ✭ 1,525 (+1960.81%)
Mutual labels:  starlette
mongox
Familiar async Python MongoDB ODM
Stars: ✭ 113 (+52.7%)
Mutual labels:  starlette
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+53397.3%)
Mutual labels:  starlette

gino-starlette

Codacy Badge

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)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].