Skip to main content

SQLAlchemyStorage for aiogram FSM

GitHub Actions Workflow Status

PyPI - License

PyPI - Version

PyPI - Wheel

Overview

SQLAlchemyStorage is a storage backend for aiogram's finite state machine (FSM) using SQLAlchemy. It provides an efficient and flexible way to persist FSM state and data using an asynchronous database session.

Installation

Use pip to install in your environment:

pip install aiogram-sqlalchemy-storage

Quick Start

from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine, async_sessionmaker
from sqlalchemy.orm import declarative_base
from sqlalchemy_storage import SQLAlchemyStorage
from aiogram import Bot, Dispatcher

# Setup database
engine = create_async_engine("sqlite+aiosqlite:///database.db")
SessionLocal = async_sessionmaker(bind=engine, class_=AsyncSession, expire_on_commit=False)
Base = declarative_base()

# Initialize storage
storage = SQLAlchemyStorage(sessionmaker=SessionLocal, metadata=Base.metadata)

# Setup bot
bot = Bot(token="YOUR_BOT_TOKEN")
dp = Dispatcher(storage=storage)

Features

  • Asynchronous support with AsyncSession
  • Customizable table name for storing FSM data
  • Pluggable key-building strategy
  • JSON serialization customization

Documentation

For detailed documentation, configuration options, and advanced usage, see:

Change Log

License

MIT License

Contributions

Contributions are welcome! Feel free to submit issues or pull requests on the repository.

Metadata

Release files for aiogram-sqlalchemy-storage 0.2.0.post0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiogram-sqlalchemy-storage 0.2.0.post0
File Size Uploaded Provenance Actions
aiogram_sqlalchemy_storage-0.2.0.post0.tar.gz 4.6 kB Without provenance Details for aiogram_sqlalchemy_storage-0.2.0.post0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiogram-sqlalchemy-storage 0.2.0.post0
File Interpreter ABI Platform Actions
aiogram_sqlalchemy_storage-0.2.0.post0-py3-none-any.whl Python 3 none any Details for aiogram_sqlalchemy_storage-0.2.0.post0-py3-none-any.whl

Total release size: 9.9 kB

Release files / aiogram_sqlalchemy_storage-0.2.0.post0.tar.gz

Download URL aiogram_sqlalchemy_storage-0.2.0.post0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d37c8157766b0542cad3663496b90c53c5b07612817da3b82a79a38937debc0
BLAKE2b-256 checksum
How to use checksums
e4af1c2cd52636bcf2e1396af8b836059c6b02cae2fded2410366e2278af234e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Release files / aiogram_sqlalchemy_storage-0.2.0.post0-py3-none-any.whl

Download URL aiogram_sqlalchemy_storage-0.2.0.post0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3523ae32ad9969412c6871246a019f9408bb4ef4b932c5d0e9bd9a63d5a8c732
BLAKE2b-256 checksum
How to use checksums
5a1cf6105ec8782c23cca4e6e7996910a554946e26647b649a0f347eb1606ad1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.10

Security for aiogram-sqlalchemy-storage 0.2.0.post0

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.

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