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.
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:
python -m 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
Built Distribution
File details
Details for the file sqlite2rest-1.1.0.tar.gz
.
File metadata
- Download URL: sqlite2rest-1.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a3b31c510f147186d1c3f9ca924808c79ee8f8a574251fbaff5265f558044e8 |
|
MD5 | e115e38afd71ff72605865b1aecbc373 |
|
BLAKE2b-256 | eb303c3450ec4e06c282622e68488a05ff9cb17e66983b68c83e1135bd9e1af7 |
File details
Details for the file sqlite2rest-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: sqlite2rest-1.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19bc5961d5b5c28bb0ce6e24bbb18958c208d62419bb54da4df0932db04acd9e |
|
MD5 | 6f150aced0356f75325e6f371b4f26da |
|
BLAKE2b-256 | 7934fd5dde8d85dcb78e45094735a1969e80e95465b2f51bb5a90dea3ca3178e |