Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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.

Files for SQLAlchemy-Handler, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size SQLAlchemy_Handler-0.0.3-py2.py3-none-any.whl (16.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size SQLAlchemy-Handler-0.0.3.tar.gz (14.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page