Flask-SQLAlchemy is a Flask extension which adds support for the SQLAlchemy.
Install and update using pip:
$ pip install -U flask-sqlalchemy
We encourage you to use a virtualenv. Check the docs for complete installation, version requirement, and usage instructions.
Pretty easy to get started:
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = SQLAlchemy(app)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
email = db.Column(db.String(120), unique=True, nullable=False)
For more details, see the quickstart example.
In short we use pytest and tox. You should be able to:
$ git clone git@github.com:pallets/flask-sqlalchemy.git $ cd flask-sqlalchemy $ tox
That will run everything, so you might want to start with something like tox -e py37
or whatever
version of Python you have installed.
You can figure out our testing and documentation dependencies by further inspecting the tox.ini
file in the root of the project.
Join us at:
- the #pocoo IRC channel on irc.freenode.net
- https://discord.gg/t6rrQZH
- Home: https://github.com/pallets/flask-sqlalchemy
- Documentation: http://flask-sqlalchemy.pocoo.org/
- Releases: https://pypi.org/project/Flask-SQLAlchemy/
- Issue tracker: https://github.com/pallets/flask-sqlalchemy/issues
- Test status:
- Linux: https://travis-ci.org/pallets/flask-sqlalchemy/
- Mac, Windows: none yet, see #690
- Test coverage: https://codecov.io/gh/pallets/flask-sqlalchemy/