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.4.tar.gz (132.2 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-2.4.4-py2.py3-none-any.whl (17.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: Flask-SQLAlchemy-2.4.4.tar.gz
  • Upload date:
  • Size: 132.2 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.4.tar.gz
Algorithm Hash digest
SHA256 bfc7150eaf809b1c283879302f04c42791136060c6eeb12c0c6674fb1291fae5
MD5 63a522cb82a75292dc8bc77b6d26187a
BLAKE2b-256 ccd358d45c266b1c6e9f54a12af54f444547b142f6312e4520c771de0171d031

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Flask_SQLAlchemy-2.4.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.4 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.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05b31d2034dd3f2a685cbbae4cfc4ed906b2a733cff7964ada450fd5e462b84e
MD5 07b1bd02646a670366394301df0082cb
BLAKE2b-256 af4b3dd83c3e2c6e3034b804d971952e0120606506f153990cc56d2d33173b72

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