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

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 /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.
  • 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.

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.2.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

sqlite2rest-1.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlite2rest-1.2.0.tar.gz
  • Upload date:
  • Size: 6.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.2.0.tar.gz
Algorithm Hash digest
SHA256 d3409d011472c692ba8976304e914668070368216228cee8e4bd2d6793fe9968
MD5 116eae4152ec1ef30852724c5e9c07e5
BLAKE2b-256 9f2b63730bf61205b6e82cfca591d9c50b298d8afb0893a2bb6a71865118f679

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sqlite2rest-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f48a1d4d0aefaab4c5d5e77c1afda16c2458e165bc6191179388afb702dac76a
MD5 758de0af7086f43bd5dbae6aa18f8736
BLAKE2b-256 5f8ae4a396fcb17526295bce2acef34c9e555567e23c1b93c700a26c59d36caa

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