Skip to main content

Adds 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)
    email = db.Column(db.String, unique=True, nullable=False)


db.session.add(User(name="Flask", email="example@example.com"))
db.session.commit()

users = User.query.all()

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

Uploaded Source

Built Distribution

Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl (17.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: Flask-SQLAlchemy-2.5.1.tar.gz
  • Upload date:
  • Size: 132.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1

File hashes

Hashes for Flask-SQLAlchemy-2.5.1.tar.gz
Algorithm Hash digest
SHA256 2bda44b43e7cacb15d4e05ff3cc1f8bc97936cc464623424102bfc2c35e95912
MD5 dcb6b62248ced71dab183f2cb2778583
BLAKE2b-256 35f039dd2d8e7e5223f78a5206d7020dc0e16718a964acfb3564d89e9798ab9b

See more details on using hashes here.

File details

Details for the file Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl.

File metadata

  • Download URL: Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1

File hashes

Hashes for Flask_SQLAlchemy-2.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f12c3d4cc5cc7fdcc148b9527ea05671718c3ea45d50c7e732cceb33f574b390
MD5 e1cf21156434a9eaf1e47738d4267bbf
BLAKE2b-256 262c9088b6bd95bca539230bbe9ad446737ed391aab9a83aff403e18dded3e75

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