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
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"
class Base(DeclarativeBase):
pass
db = SQLAlchemy(app, model_class=Base)
class User(db.Model):
id: Mapped[int] = mapped_column(db.Integer, primary_key=True)
username: Mapped[str] = mapped_column(db.String, unique=True, nullable=False)
with app.app_context():
db.create_all()
db.session.add(User(username="example"))
db.session.commit()
users = db.session.execute(db.select(User)).scalars()
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.
Links
Documentation: https://flask-sqlalchemy.palletsprojects.com/
Changes: https://flask-sqlalchemy.palletsprojects.com/changes/
PyPI Releases: https://pypi.org/project/Flask-SQLAlchemy/
Source Code: https://github.com/pallets-eco/flask-sqlalchemy/
Issue Tracker: https://github.com/pallets-eco/flask-sqlalchemy/issues/
Website: https://palletsprojects.com/
Twitter: https://twitter.com/PalletsTeam
Metadata
Release files for Flask-SQLAlchemy 3.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flask_sqlalchemy-3.1.1.tar.gz | 81.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flask_sqlalchemy-3.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.0 kB
Release files / flask_sqlalchemy-3.1.1.tar.gz
| Download URL | flask_sqlalchemy-3.1.1.tar.gz |
|---|---|
| Size | 81.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4b68bb881802dda1a7d878b2fc84c06d1ee57fb40b874d3dc97dabfa36b8312
|
|
BLAKE2b-256 checksum How to use checksums |
9153b0a9fcc1b1297f51e68b69ed3b7c3c40d8c45be1391d77ae198712914392
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / flask_sqlalchemy-3.1.1-py3-none-any.whl
| Download URL | flask_sqlalchemy-3.1.1-py3-none-any.whl |
|---|---|
| Size | 25.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ba4be7f419dc72f4efd8802d69974803c37259dd42f3913b0dcf75c9447e0a0
|
|
BLAKE2b-256 checksum How to use checksums |
1d6a89963a5c6ecf166e8be29e0d1bf6806051ee8fe6c82e232842e3aeac9204
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for Flask-SQLAlchemy 3.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.