Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Automated REST APIs for existing database-driven systems

Project description

sandman “makes things REST”. Have an existing database you’d like to expose via a REST API? Normally, you’d have to write a ton of boilerplate code for the ORM you’re using.

We’re programmers. We don’t write boilerplate.

Simple Setup

from sandman import app, db

app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///chinook'

from sandman.model import register, Model

class Artist(Model):
    __tablename__ = 'Artist'

class Album(Model):
    __tablename__ = 'Album'

class Playlist(Model):
    __tablename__ = 'Playlist'

register((Artist, Album, Playlist))

app.run()

Let’s start our new API server and make a request.

$ python runserver.py &
* Running on http://127.0.0.1:5000/

$ curl GET http://localhost:5000/artists

Here is the JSON returned:

{
    "ArtistId": 273,
    "Name": "C. Monteverdi, Nigel Rogers - Chiaroscuro; London Baroque; London Cornett & Sackbu",
    "links": [
    {
        "rel": "self",
        "uri": "/artists/ArtistId"
    }
    ]
},
{
    "ArtistId": 274,
    "Name": "Nash Ensemble",
    "links": [
    {
        "rel": "self",
        "uri": "/artists/ArtistId"
    }
    ]
},
{
    "ArtistId": 275,
    "Name": "Philip Glass Ensemble",
    "links": [
    {
        "rel": "self",
        "uri": "/artists/ArtistId"
    }
    ]
}
]

Batteries Included

With sandman, (almost) zero boilerplate code is required. Your existing database structure and schema is introspected and your database tables magically get a RESTful API. For each table, Sandman creates:

  • proper endpoints

  • support for a configurable set of HTTP verbs

    • GET
    • POST
    • PATCH
    • DELETE
  • responses with appropriate rel links automatically

  • essentially a HATEOAS-based service sitting in front of your database

Warning: Sandman is still very much a work in progress. It is not suitable for use anywhere. Don’t use it for anything important. It’s also often changing in backwards incompatible ways.

Project details


Release history Release notifications

History Node

0.9.8

History Node

0.9.7

History Node

0.9.6

History Node

0.9.5

History Node

0.9.4

History Node

0.9.3.2

History Node

0.9.3.1

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

History Node

0.8.1.2

History Node

0.8.1

History Node

0.7.9

History Node

0.7.8

History Node

0.7.7

History Node

0.7.7rc3

History Node

0.7.7rc2

History Node

0.7.7rc1

History Node

0.7.6

History Node

0.7.5

History Node

0.7.4

History Node

0.7.3

History Node

0.7.2

History Node

0.7.1

History Node

0.7.0

History Node

0.6.6

History Node

0.6.5

History Node

0.6.5a1

History Node

0.6.4

History Node

0.6.3

History Node

0.6.2

History Node

0.6.1

History Node

0.6

History Node

0.5

History Node

0.4.1

History Node

0.4.0

History Node

0.3.0

History Node

0.2.3.4

History Node

0.2.3.2

This version
History Node

0.2.3.1

History Node

0.2.3

History Node

0.2.2

History Node

0.2.2b

History Node

0.2.1

History Node

0.1

History Node

0.0.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
sandman-0.2.3.1.tar.gz (8.7 kB) Copy SHA256 hash SHA256 Source None Aug 9, 2013

Supported by

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