# 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](https://sqlalchemy-helpers.readthedocs.io).
You can install it [from PyPI](https://pypi.org/project/sqlalchemy-helpers/).
![PyPI](https://img.shields.io/pypi/v/sqlalchemy-helpers.svg)
![Supported Python versions](https://img.shields.io/pypi/pyversions/sqlalchemy-helpers.svg)
![Build status](https://github.com/fedora-infra/sqlalchemy-helpers/actions/workflows/main.yml/badge.svg?branch=develop)
![Documentation](https://readthedocs.org/projects/sqlalchemy-helpers/badge/?version=latest)
## 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()` or `exists_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()` or `update_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](https://sqlalchemy-helpers.readthedocs.io/en/latest/user.html) to learn
how to use it in your application, with or without a web framework.
## FAQ
- Why not use [Flask-SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com) and
[Flask-Migrate](https://github.com/miguelgrinberg/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.
Raw data
{
"_id": null,
"home_page": "http://github.com/fedora-infra/sqlalchemy-helpers",
"name": "sqlalchemy-helpers",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.8.0",
"maintainer_email": null,
"keywords": "database, web, fedora",
"author": "Fedora Infrastructure",
"author_email": "admin@fedoraproject.org",
"download_url": "https://files.pythonhosted.org/packages/1f/c6/4109c8b6779ae6e26dace6c3d6794f5371287fcf9a29214d708abd571b75/sqlalchemy_helpers-1.0.1.tar.gz",
"platform": null,
"description": "# SQLAlchemy Helpers\n\nThis project contains a tools to use SQLAlchemy and Alembic in a project.\n\nIt has Flask and FastAPI integrations, and other framework integrations could be added\nin the future.\n\nThe full documentation is [on ReadTheDocs](https://sqlalchemy-helpers.readthedocs.io).\n\nYou can install it [from PyPI](https://pypi.org/project/sqlalchemy-helpers/).\n\n![PyPI](https://img.shields.io/pypi/v/sqlalchemy-helpers.svg)\n![Supported Python versions](https://img.shields.io/pypi/pyversions/sqlalchemy-helpers.svg)\n![Build status](https://github.com/fedora-infra/sqlalchemy-helpers/actions/workflows/main.yml/badge.svg?branch=develop)\n![Documentation](https://readthedocs.org/projects/sqlalchemy-helpers/badge/?version=latest)\n\n## Features\n\nHere's what sqlalchemy-helpers provides:\n\n- Alembic integration:\n - programmatically create or upgrade your schema,\n - get information about schema versions and status\n - drop your tables without leaving alembic information behind\n - use a function in your `env.py` script to retrieve the database URL, and\n thus avoid repeating your configuration in two places.\n - migration helper functions such as `is_sqlite()` or `exists_in_db()`\n- SQLAlchemy naming convention for easier schema upgrades\n- Automatically activate foreign keys on SQLite\n- Addition of some useful query properties on your models\n- Functions such as `get_or_create()` or `update_or_create()` that you can call directly or use on\n your model classes\n- Optional Flask integration: you can use sqlalchemy-helpers outside of a Flask app and feel at home\n- The models created with sqlalchemy-helpers work both inside and outside the Flask application\n context\n- Support for asyncio and FastAPI.\n\nThis project has 100% code coverage and aims at reliably sharing some of the basic boilerplate\nbetween applications that use SQLAlchemy.\n\nCheck out the [User Guide](https://sqlalchemy-helpers.readthedocs.io/en/latest/user.html) to learn\nhow to use it in your application, with or without a web framework.\n\n## FAQ\n\n- Why not use [Flask-SQLAlchemy](https://flask-sqlalchemy.palletsprojects.com) and\n [Flask-Migrate](https://github.com/miguelgrinberg/Flask-Migrate/)?\n\nThose projects are great, but we also have apps that are not based on Flask and that would benefit\nfrom the features provided by sqlalchemy-helpers.\n\n- Is it used?\n\nQuite a few applications among the Fedora Infrastructure applications use this library to avoid\ncode duplication. It is unlikely that we'll drop it, unless we drop SQLAlchemy itself, or Python.\nWhich is even more unlikely.\n\n",
"bugtrack_url": null,
"license": "LGPL-3.0-or-later",
"summary": "SQLAlchemy Helpers",
"version": "1.0.1",
"project_urls": {
"Homepage": "http://github.com/fedora-infra/sqlalchemy-helpers",
"Repository": "http://github.com/fedora-infra/sqlalchemy-helpers"
},
"split_keywords": [
"database",
" web",
" fedora"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "83f88db356287709f48419757bec55230104dd37b3977513695def228950cc30",
"md5": "f97ac4b887c28c7732f0e6dc0ae2e304",
"sha256": "1a80688c2a145c0edb63d8b6ab63872bd528d206f7da2de006f33ae480daf1a6"
},
"downloads": -1,
"filename": "sqlalchemy_helpers-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f97ac4b887c28c7732f0e6dc0ae2e304",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.8.0",
"size": 25810,
"upload_time": "2024-06-05T16:28:40",
"upload_time_iso_8601": "2024-06-05T16:28:40.137642Z",
"url": "https://files.pythonhosted.org/packages/83/f8/8db356287709f48419757bec55230104dd37b3977513695def228950cc30/sqlalchemy_helpers-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1fc64109c8b6779ae6e26dace6c3d6794f5371287fcf9a29214d708abd571b75",
"md5": "16fd63bc0f87a75252320efbad3796d7",
"sha256": "d1b874b2e22cc7b10bcec030f7b53bf65ccea66f1d4e4dec3f33d8e748298901"
},
"downloads": -1,
"filename": "sqlalchemy_helpers-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "16fd63bc0f87a75252320efbad3796d7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.8.0",
"size": 40677,
"upload_time": "2024-06-05T16:28:41",
"upload_time_iso_8601": "2024-06-05T16:28:41.509154Z",
"url": "https://files.pythonhosted.org/packages/1f/c6/4109c8b6779ae6e26dace6c3d6794f5371287fcf9a29214d708abd571b75/sqlalchemy_helpers-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-05 16:28:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fedora-infra",
"github_project": "sqlalchemy-helpers",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "sqlalchemy-helpers"
}