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


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

users = User.query.all()

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

Uploaded Source

Built Distribution

Flask_SQLAlchemy-3.0.0a1-py2.py3-none-any.whl (22.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file Flask-SQLAlchemy-3.0.0a1.tar.gz.

File metadata

  • Download URL: Flask-SQLAlchemy-3.0.0a1.tar.gz
  • Upload date:
  • Size: 137.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for Flask-SQLAlchemy-3.0.0a1.tar.gz
Algorithm Hash digest
SHA256 fa8218afe1e1bc4201ae8770ae2436f25eae270a8ceba0eecae69855567f5cf6
MD5 af3eb4644772e0dbcf91ae3f107b0c5c
BLAKE2b-256 74e33a9c2a071afa16d89e020a5e28254e36086a092ec7918e88667d4243b39a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Flask_SQLAlchemy-3.0.0a1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9313f625fa0d23297ff3257c2065684f8f840b37acb5072964c7341aceecc5d3
MD5 3a3d7c38d74a302d8a4dca080816c1c9
BLAKE2b-256 a39a72f0fdb37b8cb8bfcedda4fe2a86861222fc1dd2a2243e2a374f371f29a7

See more details on using hashes here.

Supported by

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