You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
David Lord 2d9257e79b
update test config, drop py36
20 hours ago
.github update test config, drop py36 20 hours ago
artwork Committed new artwork 12 years ago
docs docs rename changelog to changes 1 year ago
examples Update old Pocoo links 1 year ago
requirements use pip-compile-multi 21 hours ago
src/flask_sqlalchemy Change the default MySQL charset to utf8mb4 10 months ago
tests SignallingSession.get_bind passes kwargs through to super 1 year ago
.editorconfig add editorconfig 2 years ago
.gitignore Update .gitignore to ignore virtual envs 10 months ago
.pre-commit-config.yaml update pre-commit hooks 21 hours ago
.readthedocs.yaml use rtd to build docs for prs 1 year ago
CHANGES.rst update test config, drop py36 20 hours ago
CODE_OF_CONDUCT.md Addition of COC in reference to other Pallet Projects (#734) 3 years ago
CONTRIBUTING.rst update contributing guide 2 years ago
LICENSE.rst update project data for Pallets 3 years ago
MANIFEST.in use pip-compile to pin dev requirements 2 years ago
README.rst Merge remote-tracking branch 'origin/2.x' 1 year ago
setup.cfg move version to setup.cfg 1 year ago
setup.py move version to setup.cfg 1 year ago
tox.ini update test config, drop py36 20 hours ago

README.rst

Flask-SQLAlchemy

Flask-SQLAlchemy is an extension for Flask that adds support for SQLAlchemy to your application. It aims to simplify using SQLAlchemy with Flask by providing useful defaults and extra helpers that make it easier to accomplish common tasks.

Installing

Install and update using pip:

$ pip install -U Flask-SQLAlchemy

A Simple Example

from flask import Flask
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
db = SQLAlchemy(app)


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String, unique=True, nullable=False)
    email = db.Column(db.String, unique=True, nullable=False)


db.session.add(User(username="Flask", email="example@example.com"))
db.session.commit()

users = User.query.all()

Contributing

For guidance on setting up a development environment and how to make a contribution to Flask-SQLAlchemy, see the contributing guidelines.

Donate

The Pallets organization develops and supports Flask-SQLAlchemy and other popular packages. In order to grow the community of contributors and users, and allow the maintainers to devote more time to the projects, please donate today.