Skip to main content

Flask SQLAlchemy backend supporting the Python 3.7 version of Flask SQLAlchemy compat.

Project description

Flask SQLAlchemy backend supporting the Python 3.7 version of Flask SQLAlchemy compat.

This package is forked from an unofficial version of Flask SQLAlchemy. The motication of uploading this fork to PyPI includes:

1. Bring the DeclarativeBase feature to Python 3.7. The official version is up to 3.0.5 which is not compatible with the sqlalchemy2 style.

2. Serve as a backend support of the package flask-sqlalchemy-compat when using Python 3.7

If you are using Pyhon<3.7, you should not use flask-sqlalchemy-compat, the only available choice is flask-sqlalchemy.

If you are using Python>=3.8, you do not need this package, because flask-sqlalchemy is already compatible with Python>=3.8.

Reference

Flask SQLAlchemy compat

Forked from Flask SQLAlchemy

See details of this version

Flask-SQLAlchemy

The following part is from the original README file.

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
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///example.sqlite"

class Base(DeclarativeBase):
  pass

db = SQLAlchemy(app, model_class=Base)

class User(db.Model):
    id: Mapped[int] = mapped_column(db.Integer, primary_key=True)
    username: Mapped[str] = mapped_column(db.String, unique=True, nullable=False)

with app.app_context():
    db.create_all()

    db.session.add(User(username="example"))
    db.session.commit()

    users = db.session.execute(db.select(User)).scalars()

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

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file flask_sqlalchemy_compat_backend_py37-3.1.0.dev3.tar.gz.

File metadata

File hashes

Hashes for flask_sqlalchemy_compat_backend_py37-3.1.0.dev3.tar.gz
Algorithm Hash digest
SHA256 8ed0dcb2236e595a03c8bf9adbf4651380504159febffc8af66fe3d3b2ef4b21
MD5 70d7672d85255fc78305171f53bc11c2
BLAKE2b-256 c5e9dfe2ab1134016ea370c9b778b62e308d658f2d1ef34de6b6c06bdd9316fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_sqlalchemy_compat_backend_py37-3.1.0.dev3.tar.gz:

Publisher: publish.yaml on cainmagi/flask-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file Flask_SQLAlchemy_compat_backend_py37-3.1.0.dev3-py3-none-any.whl.

File metadata

File hashes

Hashes for Flask_SQLAlchemy_compat_backend_py37-3.1.0.dev3-py3-none-any.whl
Algorithm Hash digest
SHA256 28365044728be1af1ea70ae56e04b55cfbb983f87d029404f63c4f328e8cc0d2
MD5 561898b3da17750c938a501994181409
BLAKE2b-256 0ca51aa0a2d4938102a61cf24ecbcc29555d413bc3092c8daa47673fea4d095a

See more details on using hashes here.

Provenance

The following attestation bundles were made for Flask_SQLAlchemy_compat_backend_py37-3.1.0.dev3-py3-none-any.whl:

Publisher: publish.yaml on cainmagi/flask-sqlalchemy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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