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

Uploaded Source

Built Distribution

Flask_SQLAlchemy-2.5.0-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.0.tar.gz.

File metadata

  • Download URL: Flask-SQLAlchemy-2.5.0.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.0.tar.gz
Algorithm Hash digest
SHA256 27448f04f46cfb7588ff30a4b7efb08b91d99f80dbee3d884c3cf76fab01cca2
MD5 ea2122a33970eec74b6a8c5315681d5c
BLAKE2b-256 8cc1a51f224b86d148e5d3434e6b548d7ccef74988e1cfa6cad011e81135fc9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Flask_SQLAlchemy-2.5.0-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.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0d5153bf451c42880540eea7650300cf0dfec0c16c554f0de5541e78c7cc0443
MD5 56d05c07160914c0839a2097ddbfb2ca
BLAKE2b-256 6885fd40f11861d97cbaf4b0369288a293f2017dcea1fd52da2a652b2ceae15a

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