Skip to main content

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.

PyPI Supported Python versions Build status Documentation

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 to learn how to use it in your application, with or without a web framework.

FAQ

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


Download files

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

Source Distribution

sqlalchemy_helpers-2.0.1.tar.gz (42.1 kB view details)

Uploaded Source

Built Distribution

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

sqlalchemy_helpers-2.0.1-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_helpers-2.0.1.tar.gz.

File metadata

  • Download URL: sqlalchemy_helpers-2.0.1.tar.gz
  • Upload date:
  • Size: 42.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sqlalchemy_helpers-2.0.1.tar.gz
Algorithm Hash digest
SHA256 e6b1799fcc13edfeae90e2c09b1f15729ff02497c6ae10848f4b3f4c3cf72aa2
MD5 597c4aaa2895c37748f764819b981cde
BLAKE2b-256 891c86fd570a2a0a21a21a8bf9b7954d9285a022fba201eed346a7c9b99a255d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_helpers-2.0.1.tar.gz:

Publisher: main.yml on fedora-infra/sqlalchemy-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqlalchemy_helpers-2.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_helpers-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c37737674245ead7d679e08ff63e908f8d9ce2d6dd79c0619cfd37224e336113
MD5 06946d39ed1ed3c930e5203233044507
BLAKE2b-256 e94da837b659421d3783322f7ca11bd748b20fa953cf8a5be84df87a6fcad977

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_helpers-2.0.1-py3-none-any.whl:

Publisher: main.yml on fedora-infra/sqlalchemy-helpers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page