Skip to main content

Flaxon SQLAlchemy

flaxon-sqlalchemy gives a Flaxon application one async SQLAlchemy engine and session factory. It owns the engine lifecycle and exposes the integration as app.state.sqlalchemy.

Install

pip install "flaxon-sqlalchemy[postgresql]"
# or: pip install "flaxon-sqlalchemy[sqlite]"

Use an async SQLAlchemy URL, such as postgresql+asyncpg://… or sqlite+aiosqlite:///./app.db.

Use

from flaxon import Flaxon
from flaxon_sqlalchemy import SQLAlchemyPlugin
from sqlalchemy import text

app = Flaxon("store")
await app.plugins.load_plugin(
    SQLAlchemyPlugin("postgresql+asyncpg://user:password@localhost/store")
)


@app.get("/orders")
async def list_orders():
    async with app.state.sqlalchemy.session() as session:
        result = await session.execute(text("SELECT id FROM orders"))
        return {"orders": list(result.scalars())}

The plugin connects during Flaxon's startup lifecycle and disposes its engine during shutdown. Do not construct URLs with unescaped passwords; load them from a secret manager or environment variable.

This package provides connection lifecycle and session access. Define models, migrations, and transaction boundaries in your application.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flaxon_sqlalchemy-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flaxon_sqlalchemy-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file flaxon_sqlalchemy-0.1.0.tar.gz.

File metadata

  • Download URL: flaxon_sqlalchemy-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for flaxon_sqlalchemy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 65f588565f58bd9f4ae16ff28842e2dd6be3a3b27fce1b23786d6f6041c601db
MD5 e36d5935eb0283bbe7f7be9526422e31
BLAKE2b-256 5ac7ec253f4e8032f6e9dfd24817e6ada9f72fdfb4beee84a64ea58930cfeb01

See more details on using hashes here.

File details

Details for the file flaxon_sqlalchemy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flaxon_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae255b3ec39aab7e889a73f2f8e8020a38faae4c06504e49542785fb77c91552
MD5 9ae4e6913dcb1091f4d21d593f61584f
BLAKE2b-256 406729c124ed8fe74aab6be0cfe15741c6cee8a41b7ce86cd8e21ea256d24048

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page