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.0.tar.gz (127.2 kB view details)

Uploaded Source

Built Distribution

Flask_SQLAlchemy-3.0.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: Flask-SQLAlchemy-3.0.0.tar.gz
  • Upload date:
  • Size: 127.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.1.4 CPython/3.10.7

File hashes

Hashes for Flask-SQLAlchemy-3.0.0.tar.gz
Algorithm Hash digest
SHA256 b54939fd5f48184742b7d5b222d86983e233b43140c1071a36327353e86f3b56
MD5 b627112d87b6c83ef9e64af33e98eecc
BLAKE2b-256 66d8b089848b8efe589c4eeef66742e79ed240123a19f064983695a754a88e16

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_SQLAlchemy-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 741dabf0903569a89e4793667e25be5bb9581e614fa0eeb81a395cc7dee40c4b
MD5 f6c886c85cf8dcd6c98a44f32c581460
BLAKE2b-256 8bf7ee9396c347cdc61d95f20574ae20490d9f474d6255d75a01592ea95f8cbc

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