Skip to main content

SQLAlchemy Adapter

For SQLite, PostgreSQL, and other SQLAlchemy-supported databases.

Install

pip install 'nexfetch-auth[sqlalchemy]' # SQLite
pip install 'nexfetch-auth[postgresql]' # PostgreSQL

Usage

from nexfetch_auth.db.adapters.sqlalchemy import sqlalchemy_adapter

# SQLite
db = await sqlalchemy_adapter("sqlite+aiosqlite:///auth.db")

# PostgreSQL
db = await sqlalchemy_adapter("postgresql+asyncpg://user:pass@localhost/auth")

auth = await nexfetch_auth(secret="...", database=db)

Tables are created automatically on first run.