Flask-Alchemy

The fastest markdown parser in pure Python


License
BSD-3-Clause
Install
pip install Flask-Alchemy==0.1

Documentation

Flask-Alchemy

WIP

Flask-Alchemy is designed to work with SQLAlchemy default declarative_base, with powerful master-slave and separated databases support.

Meta Flask Wheel Status Latest Version Travis CI Status Coverage Status

Getting Started

Flask-Alchemy is designed to work with plain SQLAlchemy models, if describe it in code, a plain model should be something like:

from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class User(Base):
    __tablename__ = 'user'
    id = Column(Integer, primary_key=True)
    name = Column(String(20))

And then we can register the Base with Flask-Alchemy:

from your_project import app
from flask_alchemy import Alchemy

db = Alchemy(app)
db.register_base(Base)

With this db.register_base, your User module can query like:

baba = User.query.filter_by(name='baba').first()

Advanced Topics

Flask-Alchemy is more than that, it can bind each table to its own database, it can send the SELECT query to your slave databases.