Skip to main content

Add SQLAlchemy support to your Flask application.

Project description

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)

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-SQLAlchemy-3.0.3.tar.gz (135.5 kB view details)

Uploaded Source

Built Distribution

Flask_SQLAlchemy-3.0.3-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file Flask-SQLAlchemy-3.0.3.tar.gz.

File metadata

  • Download URL: Flask-SQLAlchemy-3.0.3.tar.gz
  • Upload date:
  • Size: 135.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for Flask-SQLAlchemy-3.0.3.tar.gz
Algorithm Hash digest
SHA256 2764335f3c9d7ebdc9ed6044afaf98aae9fa50d7a074cef55dde307ec95903ec
MD5 0ddf4a784c17000bf2cd5d5870158075
BLAKE2b-256 7a33b0418aaeb6b122fccfdea1bf3c06843225ba29159b65c0acf9bd4285ee01

See more details on using hashes here.

File details

Details for the file Flask_SQLAlchemy-3.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_SQLAlchemy-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 add5750b2f9cd10512995261ee2aa23fab85bd5626061aa3c564b33bb4aa780a
MD5 552e88493e4416f5b40b1cbd5d97fb3b
BLAKE2b-256 cf93606d1967d6ef1c663ccccc739b361e7672ec057bf086ca7e4cd23eda18a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page