Name Date Size

..27-Apr.-20224 KiB

.editorconfigH A D13-Jul.-2020217

.github/H28-Apr.-20214 KiB

.gitignoreH A D13-Jul.-2020128

.pre-commit-config.yamlH A D11-May-2021828

.readthedocs.yamlH A D19-Mar.-2021155

artwork/H13-Jul.-20204 KiB

CHANGES.rstH A D22-Mar.-20218.3 KiB

CODE_OF_CONDUCT.mdH A D13-Jul.-20203.3 KiB

CONTRIBUTING.rstH A D16-Feb.-20216.8 KiB

docs/H19-Mar.-20214 KiB

examples/H13-Jul.-20204 KiB

LICENSE.rstH A D13-Jul.-20201.4 KiB

MANIFEST.inH A D13-Jul.-2020154

README.rstH A D19-Mar.-20212.1 KiB

requirements/H02-Jun.-20214 KiB

setup.cfgH A D19-Mar.-20212 KiB

setup.pyH A D19-Mar.-2021191

src/flask_sqlalchemy/H13-Jul.-20204 KiB

tests/H29-Mar.-20214 KiB

tox.iniH A D16-Feb.-2021519

README.rst

1Flask-SQLAlchemy
2================
3
4Flask-SQLAlchemy is an extension for `Flask`_ that adds support for
5`SQLAlchemy`_ to your application. It aims to simplify using SQLAlchemy
6with Flask by providing useful defaults and extra helpers that make it
7easier to accomplish common tasks.
8
9.. _Flask: https://palletsprojects.com/p/flask/
10.. _SQLAlchemy: https://www.sqlalchemy.org
11
12
13Installing
14----------
15
16Install and update using `pip`_:
17
18.. code-block:: text
19
20  $ pip install -U Flask-SQLAlchemy
21
22.. _pip: https://pip.pypa.io/en/stable/quickstart/
23
24
25A Simple Example
26----------------
27
28.. code-block:: python
29
30    from flask import Flask
31    from flask_sqlalchemy import SQLAlchemy
32
33    app = Flask(__name__)
34    app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
35    db = SQLAlchemy(app)
36
37
38    class User(db.Model):
39        id = db.Column(db.Integer, primary_key=True)
40        username = db.Column(db.String, unique=True, nullable=False)
41        email = db.Column(db.String, unique=True, nullable=False)
42
43
44    db.session.add(User(username="Flask", email="example@example.com"))
45    db.session.commit()
46
47    users = User.query.all()
48
49
50Contributing
51------------
52
53For guidance on setting up a development environment and how to make a
54contribution to Flask-SQLAlchemy, see the `contributing guidelines`_.
55
56.. _contributing guidelines: https://github.com/pallets/flask-sqlalchemy/blob/master/CONTRIBUTING.rst
57
58
59Donate
60------
61
62The Pallets organization develops and supports Flask-SQLAlchemy and
63other popular packages. In order to grow the community of contributors
64and users, and allow the maintainers to devote more time to the
65projects, `please donate today`_.
66
67.. _please donate today: https://palletsprojects.com/donate
68
69
70Links
71-----
72
73-   Documentation: https://flask-sqlalchemy.palletsprojects.com/
74-   Changes: https://flask-sqlalchemy.palletsprojects.com/changes/
75-   PyPI Releases: https://pypi.org/project/Flask-SQLAlchemy/
76-   Source Code: https://github.com/pallets/flask-sqlalchemy/
77-   Issue Tracker: https://github.com/pallets/flask-sqlalchemy/issues/
78-   Website: https://palletsprojects.com/
79-   Twitter: https://twitter.com/PalletsTeam
80-   Chat: https://discord.gg/pallets
81