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

Uploaded Source

Built Distribution

Flask_SQLAlchemy-2.4.2-py2.py3-none-any.whl (17.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: Flask-SQLAlchemy-2.4.2.tar.gz
  • Upload date:
  • Size: 131.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

File hashes

Hashes for Flask-SQLAlchemy-2.4.2.tar.gz
Algorithm Hash digest
SHA256 6cd9f71a97ef18ca5ae7d8bd316a32b82814efe7b088096ba68fddfd8a17cbe7
MD5 40a61ea2d6b418fbab26e28329f224a8
BLAKE2b-256 82745132705abfa12b5c47ef8538e22b3ca532767f0a81fc154b08633b742e10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Flask_SQLAlchemy-2.4.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

File hashes

Hashes for Flask_SQLAlchemy-2.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2298f6b874c2a2f1f048eaf21ce5d984e36a04ca849b0ac473050a67c8dae76f
MD5 ecd9b8969dde743ae6224f0c922ec45f
BLAKE2b-256 6aa37b8427bb41aa9348670645932c31811b898684010c51fa8db0a82d56fbdb

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