/flask-sqlalchemy

Adds SQLAlchemy support to Flask

Primary LanguagePythonOtherNOASSERTION

Flask-SQLAlchemy

Flask-SQLAlchemy is a Flask extension which adds support for the SQLAlchemy.

Installing

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.

A Simple Example

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.

Tests

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.

Help

Join us at:

Links