Skip to main content

A Python library for creating a RESTful API from an SQLite database using Flask.

Project description

SQLite2REST

SQLite2REST is a Python library that simplifies the process of creating a RESTful API from an SQLite database using the Flask web framework. It automatically reads the schema of an SQLite database and generates endpoints for each table, allowing for Create, Read, Update, and Delete (CRUD) operations. The library also generates an OpenAPI specification for the API.

Test status Documentation Status

Installation

You can install SQLite2REST using pip:

pip install sqlite2rest

Usage

You can use SQLite2REST from the command line by providing the path to your SQLite database:

sqlite2rest serve /path/to/database.db

This will start a Flask server with endpoints for each table in the database. For example, if your database has a table named users, you can access the records in this table at the /users endpoint.

You can also use the /openapi.yaml endpoint to get the OpenAPI specification for the API.

Endpoints

For each table in the database, the following endpoints are available:

  • GET /<table>: Get all records from the table.
  • GET /<table>/<id>: Returns the record with the given ID from the table.
  • POST /<table>: Create a new record in the table. The data for the record should be provided as JSON in the request body.
  • PUT /<table>/<id>: Update an existing record in the table. The data for the record should be provided as JSON in the request body.
  • DELETE /<table>/<id>: Delete an existing record from the table.

You can also generate an OpenAPI specification from an SQLite database:

sqlite2rest spec /path/to/database.db

Contributing

Contributions are welcome! Please feel free to submit a pull request.

License

SQLite2REST is licensed under the MIT license. See the LICENSE file for more details.

Project details


Download files

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

Source Distribution

sqlite2rest-1.5.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

sqlite2rest-1.5.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file sqlite2rest-1.5.0.tar.gz.

File metadata

  • Download URL: sqlite2rest-1.5.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sqlite2rest-1.5.0.tar.gz
Algorithm Hash digest
SHA256 9422a84dee3b1a616fa00c2e1183322cdaa5211c4447d87e8a21dbc8e8f81fba
MD5 8469a46640c3110228e1d49cf9826388
BLAKE2b-256 e9e9d89fa6a8934955041910deb6b7e1a2f8800fa05cfd7cbe8905cff7a60576

See more details on using hashes here.

File details

Details for the file sqlite2rest-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: sqlite2rest-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for sqlite2rest-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d22de36ae8c28b2e9f084fe812f0ba3330dbaf6ef15bd05702dedeb848ac615
MD5 cf44175630394110ad5dfce05547c96b
BLAKE2b-256 476df7c80004dd28ae0a23202beec7b38376d238188210860570e1d1f56d7f29

See more details on using hashes here.

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