Skip to main content

Feature flags, with a GUI - SQL Alchemy backend

Project description


Flypper-sqlalchemy is a storage backend for the flypper package.

It is backed by a RDBMS through the SQL-Alchemy library so it an be used in a distributed environment and be persisted across restarts.


Use the package manager pip to install flypper-sqlalchemy.

pip install flypper-sqlalchemy


Build a storage backend:

from import SqlAlchemyStorage

# Create tables, make sure they are created, for instance with `create_all()`.

storage = SqlAlchemyStorage(session=session_proxy)

# Or instead, depending on the use-case:
# storage = SqlAlchemyStorage(engine=engine)

Use it in the web UI:

from flypper.wsgi.web_ui import FlypperWebUI

web_ui = FlypperWebUI(storage=storage)

Use it in your code:

  1. Build a client for your app
  2. Use a context
from flypper.client import Client as FlypperClient

# Once per thread
flypper_client = FlypperClient(storage=storage, ttl=10)

# Once per request
flypper_context = FlypperContext(
    entries={"user_id": "42"},

# Every time you need
    entries={"item_reference": "blue-shampoo"},


How to use the ORM layer of SQL-Alchemy?

We can use the Hybrid Declarative mapping capability to build a mapped class from flypper's tables:

from sqlalchemy.ext.declarative import declarative_base

from import SqlAlchemyStorage

Base = declarative_base()

class FlypperFlag(Base):
    __table__ = SqlAlchemyStorage.build_flags_table(

class FlypperMetadata(Base):
    __table__ = SqlAlchemyStorage.build_metadata_table(


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.



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

flypper-sqlalchemy-0.1.6.tar.gz (4.9 kB view hashes)

Uploaded source

Built Distribution

flypper_sqlalchemy-0.1.6-py3-none-any.whl (7.1 kB view hashes)

Uploaded py3

Supported by

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