All Projects → vytas7 → falcon-sqla

vytas7 / falcon-sqla

Licence: Apache-2.0 license
SQLAlchemy session management middleware for Falcon applications.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to falcon-sqla

flask for startups
Flask boilerplate using a services oriented structure
Stars: ✭ 210 (+950%)
Mutual labels:  sqlalchemy
tutorials
Collection of tutorials for various libraries and technologies
Stars: ✭ 98 (+390%)
Mutual labels:  sqlalchemy
py-data-api
A user-friendly client for AWS Aurora Serverless's Data API
Stars: ✭ 37 (+85%)
Mutual labels:  sqlalchemy
mad-migration
Database migration tool for migrate different structured databases.
Stars: ✭ 29 (+45%)
Mutual labels:  sqlalchemy
futaba
Discord bot for the Programming server
Stars: ✭ 22 (+10%)
Mutual labels:  sqlalchemy
mara-db
Lightweight configuration and access to multiple databases in a single project
Stars: ✭ 36 (+80%)
Mutual labels:  sqlalchemy
SQL-for-Data-Analytics
Perform fast and efficient data analysis with the power of SQL
Stars: ✭ 187 (+835%)
Mutual labels:  sqlalchemy
graygram-web
www.graygram.com
Stars: ✭ 16 (-20%)
Mutual labels:  sqlalchemy
owl-light
Open-Falcon client-side project.
Stars: ✭ 12 (-40%)
Mutual labels:  falcon
chm-documentation
chm documentation PostgreSQL pgadmin3 SQLAlchemy Django Flask jinja2 webpy doc chm compiled html help Postgres Postgre документация russian
Stars: ✭ 17 (-15%)
Mutual labels:  sqlalchemy
peach
Lightweight framework built on top of flask, falcon with a touch of magic
Stars: ✭ 19 (-5%)
Mutual labels:  falcon
sqlalchemy-citext
CITEXT type for SQLAlchemy
Stars: ✭ 26 (+30%)
Mutual labels:  sqlalchemy
django-sqlalchemy
Django ORM built on top of SQLalchemy core 2.0 for seamless integration of SQLAlchemy with Django 4.1+ PostgreSQL 14+ only for now. [pre POC now]
Stars: ✭ 101 (+405%)
Mutual labels:  sqlalchemy
flask-restalchemy
Flask extension to build REST APIs based on SQLAlchemy models
Stars: ✭ 34 (+70%)
Mutual labels:  sqlalchemy
AUCR
Analyst Unknown Cyber Range - a micro web service framework
Stars: ✭ 24 (+20%)
Mutual labels:  sqlalchemy
alembic utils
An alembic/sqlalchemy extension for migrating sql views, functions, triggers, and policies
Stars: ✭ 105 (+425%)
Mutual labels:  sqlalchemy
flask-tweeeter
A full-stack Twitter clone made using the Flask framework for Python 🐦
Stars: ✭ 28 (+40%)
Mutual labels:  sqlalchemy
AnyBlok
AnyBlok is a Python framework for building business applications.
Stars: ✭ 19 (-5%)
Mutual labels:  sqlalchemy
trashed
Trashed is an organizational tool designed to help users keep their communities clean.
Stars: ✭ 13 (-35%)
Mutual labels:  sqlalchemy
pygameweb
🎮🕸️ pygame.org website. Python, PostgreSQL, Flask, sqlalchemy, JS.
Stars: ✭ 94 (+370%)
Mutual labels:  sqlalchemy

Build Status PyPi Documentation codecov.io

Falcon Middleware: SQLAlchemy Integration

The falcon-sqla package provides a middleware component for managing SQLAlchemy sessions. The manager component can also serve as a base building block or a recipe for more complex use cases, such as applications leveraging multiple database binds.

Installation

$ pip install falcon-sqla

Usage

The falcon_sqla session Manager can be used in two ways:

Configuration

  • Create a SQLAlchemy engine.
  • Pass the engine to the Manager() initializer as its first parameter.
  • If using the manager as a middleware component, pass its middleware property to a falcon.App's middleware list:
engine = create_engine('dialect+driver://my/database')
manager = falcon_sqla.Manager(engine)

app = falcon.App(middleware=[manager.middleware])

# The database session will be available as req.context.session

Context Manager

A falcon_sqla.Manager can also explicitly provide a database session using the session_scope() context manager:

# Somewhere inside a responder
with self.manager.session_scope(req, resp) as session:
    # Use the session
    # <...>

session_scope() can also be used as a standalone session context outside of the request-response cycle:

with self.manager.session_scope() as session:
    # Use the session
    # <...>

Custom Vertical Partitioning

Simple random selection of read- and write- database replicas is supported out of the box. Use the add_engine() method to instruct the Manager to include the provided engines in the runtime bind selection logic:

manager = falcon_sqla.Manager(engine)

read_replica = create_engine('dialect+driver://my/database.replica')
manager.add_engine(read_replica, 'r')

The Manager.get_bind() method can be overridden to implement custom engine selection logic for more complex use cases.

See also this SQLAlchemy recipe: Custom Vertical Partitioning.

About Falcon

Falcon is the minimalist REST API and microservices framework for Python developers, with a focus on reliability, correctness, and performance at scale.

About SQLAlchemy

SQLAlchemy is the Python SQL toolkit and Object Relational Mapper that gives application developers the full power and flexibility of SQL.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].