Skip to main content

SQLAlchemy >= 1.4 support for aiohttp.

Project description

SQLAlchemy >= 1.4 support for aiohttp.

Install

pip install aiohttp-sqlalchemy

Example

from aiohttp import web
import aiohttp_sqlalchemy
from aiohttp_sqlalchemy import sa_engine, sa_middleware

routes = web.RouteTableDef()

@routes.get('/')
async def main(request):
   async with request['sa_main'].begin():
      # some code

app = web.Application(middlewares=[sa_middleware()])
aiohttp_sqlalchemy.setup(app, [sa_engine('sqlite+aiosqlite:///')])
app.add_routes(routes)
web.run_app(app)

Documentation

See: https://aiohttp-sqlalchemy.readthedocs.io/

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

aiohttp-sqlalchemy-0.1a3.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

aiohttp_sqlalchemy-0.1a3-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

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