All Projects → jeffknupp → Sandman2

jeffknupp / Sandman2

Licence: apache-2.0
Automatically generate a RESTful API service for your legacy database. No code required!

Programming Languages

139335 projects - #7 most used programming language
75241 projects

Projects that are alternatives of or similar to Sandman2

Evolutility Server Node
Model-driven REST or GraphQL backend for CRUD and more, written in Javascript, using Node.js, Express, and PostgreSQL.
Stars: ✭ 84 (-95.24%)
Mutual labels:  rest-api, rest, restful-api, orm, database
Automatic Api
A list of software that turns your database into a REST/GraphQL API
Stars: ✭ 1,583 (-10.31%)
Mutual labels:  rest-api, rest, restful-api, automatic-api
Converts a database into gorm structs and RESTful api
Stars: ✭ 825 (-53.26%)
Mutual labels:  rest-api, rest, restful-api, database
PostgreSQL ➕ REST, low-code, simplify and accelerate development, ⚡ instant, realtime, high-performance on any Postgres application, existing or new
Stars: ✭ 3,023 (+71.27%)
Mutual labels:  rest-api, rest, automatic-api, database
The database toolkit for go
Stars: ✭ 524 (-70.31%)
Mutual labels:  orm, sqlalchemy, database
Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (-93.65%)
Mutual labels:  orm, sqlalchemy, database
RESTHeart - The REST API for MongoDB
Stars: ✭ 659 (-62.66%)
Mutual labels:  rest-api, rest, database
Ngx Restangular
Restangular for Angular 2 and higher versions
Stars: ✭ 787 (-55.41%)
Mutual labels:  rest-api, rest, restful-api
xmysql is now
Stars: ✭ 54 (-96.94%)
Mutual labels:  rest-api, restful-api, automatic-api
RESTful API 文档生成工具,支持 Go、Java、Swift、JavaScript、Rust、PHP、Python、Typescript、Kotlin 和 Ruby 等大部分语言。
Stars: ✭ 785 (-55.52%)
Mutual labels:  rest-api, rest, restful-api
Framework for building RESTful HATEOAS-driven applications.
Stars: ✭ 18 (-98.98%)
Mutual labels:  rest-api, rest, restful-api
Restful Api Design References
RESTful API 设计参考文献列表,可帮助你更加彻底的了解REST风格的接口设计。
Stars: ✭ 4,830 (+173.65%)
Mutual labels:  rest-api, rest, restful-api
It is always Calm before a Tornado!
Stars: ✭ 50 (-97.17%)
Mutual labels:  rest-api, rest, restful-api
Rest Api Design Guide
NBB's REST-ish API Design Guide
Stars: ✭ 643 (-63.57%)
Mutual labels:  rest-api, rest, restful-api
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (-72.69%)
Mutual labels:  rest-api, rest, restful-api
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-97.22%)
Mutual labels:  rest-api, rest, restful-api
Api Strategy
Equinor API Strategy
Stars: ✭ 56 (-96.83%)
Mutual labels:  rest-api, rest, restful-api
REST API for any Postgres database
Stars: ✭ 18,166 (+929.24%)
Mutual labels:  rest, automatic-api, database
Fast and Reliable Golang Web Framework
Stars: ✭ 354 (-79.94%)
Mutual labels:  rest-api, rest, restful-api
The simplicity of REST and the power of SQL combined in a database that automatized security and performance. Forget the database, develop faster and safer!
Stars: ✭ 31 (-98.24%)
Mutual labels:  rest-api, rest, database


Build Status Documentation Status Coverage Status

sandman2 documentation

[ ~ Dependencies scanned by ~ ]

sandman2 automagically generates a RESTful API service from your existing database, without requiring you to write a line of code. Simply point sandman2 to your database, add salt for seasoning, and voila!, a fully RESTful API service with hypermedia support starts running, ready to accept HTTP requests.

This is a big deal. It means every single database you interact with, from the SQLite database that houses your web browser's data up to your production PostgreSQL server can be endowed with a REST API and accessed programmatically, using any number of HTTP client libraries available in every language. sandman2 frees your data.

For developers:

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. Not you. Not Group Y. No one. That means no boilerplate ORM code, no database connection logic. Nothing. sandman2 can be run as a command-line tool (sandman2ctl) that just takes your database information as parameters and connects to it, introspects the schema, generates a RESTful API, and starts the server.

What Happened to Sandman (1)?

sandman, the precursor to sandman2, is no longer being maintained. sandman had almost identical functionality but had an architecture 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...

sandman2 has since surpassed the functionality of the original sandman and the latter should be considered deprecated/obsolete.


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

Admin Interface

One of the best things about the original sandman was the Admin Interface. Not only does sandman2 include the Admin Interface, but it modernizes it as well. The layout has been greatly improved, especially when dealing with larger numbers of tables. All of the original functionality of the Admin Interface remains unchanged.

Here's a shot of the new look:

admin interface awesomesauce screenshot


If sandman2ctl doesn't give you fine-grained enough control over your REST endpoints, or you'd like to restrict the set of tables made available via sandman2ctl, you can easily integrate sandman2 into your application. See the documentation for more info.

Running sandman2 under Docker

sandman2 has an official docker image at Docker Hub. Simply docker pull jeffknupp/sandman2 to get the latest version. It supports the most popular database engines, but not all that sandman2 currently natively supports. If you'd like to see support for your RDBMS, either add a pull request on this repo (if possible) or create a new issue with the details of your database's Python driver.


Here's how one would run sandman2 to connect to a PostgreSQL database running on one's host machine (i.e. not a remote database, which is far simpler) under Docker (on a Mac, explained below):

  1. $ docker pull jeffknupp/sandman2
  2. $ docker run -d -e DB_TYPE=postgres -e DB_DRIVER=psycopg2 -e USERNAME=jknupp -e DB_HOST=host.docker.internal -e DATABASE=jknupp -e DB_PORT=5432 -p 9000:5000 sandman2
  3. $ curl localhost:9000/meta or open a browser to http://localhost:9000/admin/

Note, DB_HOST=host.docker.internal is only necessary for databases that reside on the host system (and the value only works on macOS). To connect to a database on a remote machine, simply replace that value with the machine's IP or hostname.


Here are the parameters available to specify your connection information and their meaning:

  • $DB_TYPE - The type of RDBMS to connect to (e.g. postgres or mysql)
  • $DB_DRIVER - The name of the Python library to use as a driver (e.g. psycopg2 or pymysql)
  • $USERNAME - Database username
  • $PASSWORD - Database password
  • $DB_HOST - Database IP or hostname
  • $DB_PORT - Database port
  • $DATABASE - Name of database to connect to

Pass each value separately to the docker run command with -e <VARIABLE>=<VALUE>. Not all are required, but which ones are required differs based on your target RDBMS.

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].