Skip to main content

Adds SQLAlchemy support to your Flask application.

Project description

SQLAlchemy-Handler is an extension that still like Flask-SQLAlchemy adds more support for SQLAlchemy to your application. It helps to handle models with humanized ids once it is jsonified, throws api errors for some casting of value during the save time.

[![CircleCI](https://circleci.com/gh/betagouv/sqlalchemy-handler/tree/master.svg?style=svg)](https://circleci.com/gh/betagouv/sqlalchemy-handler/tree/master) [![Coverage Status](https://coveralls.io/repos/github/betagouv/sqlalchemy-handler/badge.svg)](https://coveralls.io/github/betagouv/sqlalchemy-handler)

Installing

Install and update using pip:

$ pip install -U SQLAlchemy-Handler

A Simple Example

from flask import Flask
from sqlalchemy_handler import Handler

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

class User(Handler, 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)

user = User(username="Flask", email="example@example.com")
Handler.save(user)

Deploy

First, make sure that the deploy environment is started:

./sqlah start

In a second tab, then:

  1. Change the __version__ into sqlalchemy_handler/__init__.py

  2. Pre publish:

./sqlah prepublish
  1. Publish:

./sqlah publish

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

SQLAlchemy-Handler-0.0.3.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

SQLAlchemy_Handler-0.0.3-py2.py3-none-any.whl (16.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file SQLAlchemy-Handler-0.0.3.tar.gz.

File metadata

  • Download URL: SQLAlchemy-Handler-0.0.3.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for SQLAlchemy-Handler-0.0.3.tar.gz
Algorithm Hash digest
SHA256 50b884c2e5d5f63dc85af86bb29360b1b0d0f36ea57629f5e47077ea9c3af822
MD5 414dd6a83f4ea95fbb9746a0c8d0b398
BLAKE2b-256 1c74e390b3ef442d40b87d5be6ed7d4f124cfdef88e55a5961c82ae8696f8117

See more details on using hashes here.

File details

Details for the file SQLAlchemy_Handler-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: SQLAlchemy_Handler-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for SQLAlchemy_Handler-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 52103fb58677621260a15fab109d566cd68924a0ef2605ae85f9c1e3ccae53e2
MD5 4be18e920a0acffd159f44459ab0788a
BLAKE2b-256 a84ec7f5b60757a7118856489c8e8ac11246632399275a48bce8d0d726a3e4aa

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