Ws4sqlite: Inquire SQLite by skill of HTTP

22
Ws4sqlite: Inquire SQLite by skill of HTTP

ws4sqlite is a server application that, applied to one or more SQLite data, permits to build SQL queries and statements on them by skill of REST (or higher, JSON over HTTP).

That you may want to also imagine consume cases are these the keep a ways-off access to a sqlite db is handy/wanted, let’s impart an knowledge layer for a a ways-off application, presumably serverless or even known as from a internet based internet page (after security considerations in spite of the total thing).

Shopper libraries could be found in, that can summary the “raw” JSON-based completely conversation. Ogle
here for Java/JVM, here for Sail(lang); others will regulate to.

As a snappy instance, after launching

ws4sqlite --db mydatabase.db

Or now not it’s most likely to rep a POST name to http://localhost: 12321/mydatabase, e.g. with the following body:

{
    "transaction": [
        {
            "statement": "INSERT INTO TEST_TABLE (ID, VAL, VAL2) VALUES (:id, :val, :val2)",
            "values": { "id": 1, "val": "hello", "val2": null }
        },
        {
            "query": "SELECT FROM TEST_TABLE"
        }
    ]
}

Obtaining an solution of

{
    "results": [
        {
            "success": true,
            "rowsUpdated": 1
        },
        {
            "success": true,
            "resultSet": [
                { "ID": 1, "VAL": "hello", "VAL2": null }
            ]
        }
    ]
}

Docs and a Tutorial.

  • Authentication could even be configured
    • on the client, both the utilization of HTTP Long-established Authentication or specifying the credentials in the ask;
    • on the server, both by specifying credentials (also with hashed passwords) or offering a matter to peek them up in the db itself;
  • A database could even be opened in be taught-only mode (only queries could be allowed);
  • Or now not it’s most likely to implement the utilization of only saved statements, to retain away from some forms of SQL injection and receiving SQL from the client altogether;
  • CORS Allowed Beginning keep could even be configured and enforced;
  • Or now not it’s most likely to bind to a network interface, to restrict access.

Some build picks:

  • Very thin layer over SQLite. Errors and sort translation, let’s impart, are these supplied by the SQLite driver;
  • Would not consist of HTTPS, as this could presumably well also be performed easily (and rather more and plenty more securely) with a reverse proxy;
  • Would not make stronger SQLite extensions, to make stronger portability.

Many thanks and the total credits to those good projects:

Read More

Vanic
WRITTEN BY

Vanic

β€œSimplicity, patience, compassion.
These three are your greatest treasures.
Simple in actions and thoughts, you return to the source of being.
Patient with both friends and enemies,
you accord with the way things are.
Compassionate toward yourself,
you reconcile all beings in the world.”
― Lao Tzu, Tao Te Ching