Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Falcon API resources for databases

Project Description

Falcon API resources for databases. See the fulldocumentation <>.



pip install falcon_dbapi

Packages required for specific databases:

  • PostgreSQL or other RDBMS: SQLAlchemy, alchemyjsonschema
  • ElasticSearch: elasticsearch-dsl
  • MongoDB: mongoengine


Below is an example app with:

  • an index of available resources
  • automapped tables
  • basic authentication using a token
import falcon

from falcon_dbapi.middlewares.auth_middleware import AuthMiddleware
from falcon_dbapi.middlewares.json_middleware import RequireJSON, JSONTranslator, JsonError
from falcon_dbapi.resources.index import IndexResource
from falcon_dbapi.resources.sqlalchemy import CollectionResource, SingleResource

from sqlalchemy.ext.automap import automap_base
from sqlalchemy import create_engine

from wsgiref import simple_server

engine = create_engine("sqlite:///mydatabase.db")
Base = automap_base()
Base.prepare(engine, reflect=True)

app = application = falcon.API(
        AuthMiddleware('/', {'project-id': 'token-value'}),

for name, model in Base.classes.items():
    app.add_route('/' + name, CollectionResource(model, engine)),
    app.add_route('/' + name + '/{id}', SingleResource(model, engine)),

app.add_route('/', IndexResource(['/' + name for name in Base.classes.keys()]))
app.add_error_handler(Exception, JsonError.handle)

simple_server.make_server('localhost', 8888, app).serve_forever()

Test it using httpie:

http http://localhost:8888/

Release History

This version
History Node


History Node


History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(39.7 kB) Copy SHA256 Hash SHA256
py2.py3 Wheel Dec 6, 2017
(31.8 kB) Copy SHA256 Hash SHA256
Source Dec 6, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting