Name | Date | Size | ||
---|---|---|---|---|
.. | 27-Apr.-2022 | 4 KiB | ||
.editorconfig | H A D | 13-Jul.-2020 | 217 | |
.github/ | H | 28-Apr.-2021 | 4 KiB | |
.gitignore | H A D | 13-Jul.-2020 | 128 | |
.pre-commit-config.yaml | H A D | 11-May-2021 | 828 | |
.readthedocs.yaml | H A D | 19-Mar.-2021 | 155 | |
artwork/ | H | 13-Jul.-2020 | 4 KiB | |
CHANGES.rst | H A D | 22-Mar.-2021 | 8.3 KiB | |
CODE_OF_CONDUCT.md | H A D | 13-Jul.-2020 | 3.3 KiB | |
CONTRIBUTING.rst | H A D | 16-Feb.-2021 | 6.8 KiB | |
docs/ | H | 19-Mar.-2021 | 4 KiB | |
examples/ | H | 13-Jul.-2020 | 4 KiB | |
LICENSE.rst | H A D | 13-Jul.-2020 | 1.4 KiB | |
MANIFEST.in | H A D | 13-Jul.-2020 | 154 | |
README.rst | H A D | 19-Mar.-2021 | 2.1 KiB | |
requirements/ | H | 02-Jun.-2021 | 4 KiB | |
setup.cfg | H A D | 19-Mar.-2021 | 2 KiB | |
setup.py | H A D | 19-Mar.-2021 | 191 | |
src/flask_sqlalchemy/ | H | 13-Jul.-2020 | 4 KiB | |
tests/ | H | 29-Mar.-2021 | 4 KiB | |
tox.ini | H A D | 16-Feb.-2021 | 519 |
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