SQLAlchemy Helpers
Project description
SQLAlchemy Helpers
This project contains a tools to use SQLAlchemy and Alembic in a project.
It has Flask and FastAPI integrations, and other framework integrations could be added in the future.
The full documentation is on ReadTheDocs.
You can install it from PyPI.
Features
Here's what sqlalchemy-helpers provides:
- Alembic integration:
- programmatically create or upgrade your schema,
- get information about schema versions and status
- drop your tables without leaving alembic information behind
- use a function in your
env.py
script to retrieve the database URL, and thus avoid repeating your configuration in two places. - migration helper functions such as
is_sqlite()
orexists_in_db()
- SQLAlchemy naming convention for easier schema upgrades
- Automatically activate foreign keys on SQLite
- Addition of some useful query properties on your models
- Functions such as
get_or_create()
orupdate_or_create()
that you can call directly or use on your model classes - Optional Flask integration: you can use sqlalchemy-helpers outside of a Flask app and feel at home
- The models created with sqlalchemy-helpers work both inside and outside the Flask application context
- Support for asyncio and FastAPI.
This project has 100% code coverage and aims at reliably sharing some of the basic boilerplate between applications that use SQLAlchemy.
Check out the User Guide to learn how to use it in your application, with or without a web framework.
FAQ
- Why not use Flask-SQLAlchemy and Flask-Migrate?
Those projects are great, but we also have apps that are not based on Flask and that would benefit from the features provided by sqlalchemy-helpers.
- Is it used?
Quite a few applications among the Fedora Infrastructure applications use this library to avoid code duplication. It is unlikely that we'll drop it, unless we drop SQLAlchemy itself, or Python. Which is even more unlikely.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sqlalchemy_helpers-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a80688c2a145c0edb63d8b6ab63872bd528d206f7da2de006f33ae480daf1a6 |
|
MD5 | f97ac4b887c28c7732f0e6dc0ae2e304 |
|
BLAKE2b-256 | 83f88db356287709f48419757bec55230104dd37b3977513695def228950cc30 |