• Stars
    star
    148
  • Rank 249,983 (Top 5 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 12 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A friendly wrapper for modern SQLAlchemy and Alembic

SQLA-Wrapper

A friendly wrapper for modern SQLAlchemy (v2.0 or later) and Alembic.

Documentation: https://sqla-wrapper.scaletti.dev/

Includes:

  • A SQLAlchemy wrapper, that does all the SQLAlchemy setup and gives you:

    • A scoped session extended with some useful active-record-like methods.
    • A declarative base class.
    • A helper for performant testing with a real database.
    from sqla_wrapper import SQLAlchemy
    
    db = SQLAlchemy("sqlite:///db.sqlite", **options)
    # You can also use separated host, name, etc.
    # db = SQLAlchemy(user=…, password=…, host=…, port=…, name=…)
  • An Alembic wrapper that loads the config from your application instead of from separated alembic.ini and env.py files.

    from sqla_wrapper import Alembic, SQLAlchemy
    
    db = SQLAlchemy(…)
    alembic = Alembic(db, "db/migrations")