Skip to main content

Automated REST APIs for existing database-driven systems

Project description

sandman2 is a RESTful API service provider for legacy (existing) databases. Why is that useful? Imagine you’re working for AnonymousCorp and need to access Group Y’s data, which is presented to you through some horrible API or GUI. Wouldn’t it be nice if you could just interact with that database through a REST API?

More than that, imagine if you could interact with the database through a REST API and no one had to write any code. No boilerplate ORM code, no database connection logic. Nothing. sandman2 can be run as a command-line tool (sandmanctl) that just takes your database information as parameters, then auto-magically connects to your it, introspects the schema, generates a REST API, and starts the server.

What Happened to Sandman (1)?

`sandman <http://www.github.com/jeffknupp/sandman>`__, the precursor to sandman2, is no longer being maintianed. sandman had almost identical functionality but had an architecutre that reflected the capabilities of the underlying ORM, SQLAlchemy. As of the 0.9 release, SQLAlchemy introduced the automap construct. This fundamentally changed the way that sandman could interact with the underlying database in a way that greatly simplified things. All that was needed was the actual effort to rewrite sandman from scratch…

After wrestling with the idea for a while, I finally gave in and started the rewrite project. sandman2 is that project. While I’ll continue to support sandman in the nearterm, sandman2 definitely represents the way forward.

Quickstart

Install sandman2 using pip: $ pip install sandman2. This provides the script sandman2ctl, which just takes the database URI string, described here. For example, to connect to a SQLite database in the same directory you’re running the script, you would run:

$ sandman2ctl sqlite+pysqlite:///database_file_name

To connect to a PostgreSQL database, make sure you install a driver like psycopg2 using pip, then use the following connection string:

$ sandman2ctl postgresql+psycopg2://scott:tiger@localhost/mydatabase

Again, see the SQLAlchemy documentation for a more comprehensive discussion of connection strings.

Supported Databases

sandman2 supports all databases that the underlying ORM, SQLAlchemy, supports. Presently, that includes:

  • MySQL

  • PostgreSQL

  • Oracle

  • Microsoft SQL Server

  • SQLite

  • Sybase

  • Drizzle

  • Firebird

Third-party packages extend support to:

  • IBM DB2

  • Amazon Redshift

  • SQL Anywhere

  • MonetDB

REST API Features

The RESTful API service comes with the following features:

  • Proper support for all HTTP methods

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page