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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_sqlalchemy-3.0.5-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file flask_sqlalchemy-3.0.5.tar.gz.

File metadata

  • Download URL: flask_sqlalchemy-3.0.5.tar.gz
  • Upload date:
  • Size: 78.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for flask_sqlalchemy-3.0.5.tar.gz
Algorithm Hash digest
SHA256 c5765e58ca145401b52106c0f46178569243c5da25556be2c231ecc60867c5b1
MD5 d7273df5991bcd9510afe52a1cb07bfc
BLAKE2b-256 c64e0991354600fe3e1223cd9f025dbde900b1c1fe231762e18cdaffbe55938e

See more details on using hashes here.

File details

Details for the file flask_sqlalchemy-3.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_sqlalchemy-3.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cabb6600ddd819a9f859f36515bb1bd8e7dbf30206cc679d2b081dff9e383283
MD5 223d1e286526ff87fc0d02e96212f704
BLAKE2b-256 d81dc3c5afdaebd5d5f82d2c25762f5356416bd7bc109a550c79247134e48ca3

See more details on using hashes here.

Supported by

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