You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,14 @@
2
2
3
3
> I recently started a [discussion](https://github.com/proofrock/ws4sql/discussions/44) over the future direction for this project. Take a look, and chip in if you want!
4
4
5
-
**`ws4sql`** is a server application that, applied to one or more sqlite files, allows to perform SQL queries and statements on them via REST (or better, JSON over HTTP).
5
+
**`ws4sql`** is a server application that, applied to one or more database files, allows to perform SQL queries and statements on them via REST (or better, JSON over HTTP). It supports SQLite and DuckDB.
6
6
7
-
Possible use cases are the ones where remote access to a sqlite db is useful/needed, for example a data layer for a remote application, possibly serverless or even called from a web page (*after security considerations* of course).
7
+
Possible use cases are the ones where remote access to an embedded db is useful/needed, for example a data layer for a remote application, possibly serverless or even called from a web page (*after security considerations* of course).
8
8
9
-
Client libraries are available, that will abstract the "raw" JSON-based communication. See
9
+
Client libraries are available, that will abstract the "raw" JSON-based communication. See
10
10
[here](https://github.com/proofrock/ws4sqlite-client-jvm) for Java/JVM, [here](https://github.com/proofrock/ws4sqlite-client-go) for Go(lang); others will follow.
11
11
12
-
As a quick example, after launching
12
+
As a quick example, after launching
13
13
14
14
```bash
15
15
ws4sql --db mydatabase.db
@@ -56,7 +56,7 @@ Obtaining an answer of
56
56
57
57
[Docs](https://germ.gitbook.io/ws4sql/), a [Tutorial](https://germ.gitbook.io/ws4sql/tutorial), a [Discord](https://discord.gg/nBCcq2VQPu).
58
58
59
-
- Aligned to [**SQLite 3.45.1**](https://sqlite.org/releaselog/3_45_1.html);
59
+
- Aligned to [**SQLite 3.46.1**](https://sqlite.org/releaselog/3_46_1.html) and [**DuckDB 1.1.3**](https://github.com/duckdb/duckdb/releases/tag/v1.1.3);
60
60
- A [**single executable file**](https://germ.gitbook.io/ws4sql/documentation/installation) (written in Go);
61
61
- HTTP/JSON access, with [**client libraries**](https://germ.gitbook.io/ws4sql/client-libraries) for convenience;
62
62
- Directly call `ws4sql` on a database (as above), many options available using a YAML companion file;
@@ -72,7 +72,7 @@ Obtaining an answer of
72
72
-[**Scheduled tasks**](https://germ.gitbook.io/ws4sql/documentation/sched_tasks), cron-like and/or at startup, also configurable per-db;
73
73
- Scheduled tasks can be: backup (with rotation), vacuum and/or a set of SQL statements;
74
74
- Provide [**initialization statements**](https://germ.gitbook.io/ws4sql/documentation/configuration-file#initstatements) to execute when a DB is created;
75
-
-[**WAL**](https://sqlite.org/wal.html) mode enabled by default, can be [disabled](https://germ.gitbook.io/ws4sql/documentation/configuration-file#disablewalmode);
75
+
-(for SQLite) [**WAL**](https://sqlite.org/wal.html) mode enabled by default, can be [disabled](https://germ.gitbook.io/ws4sql/documentation/configuration-file#disablewalmode);
76
76
-[**Quite fast**](features/performances.md)!
77
77
-[**Embedded web server**](https://germ.gitbook.io/ws4sql/documentation/web-server) to directly serve web pages that can access ws4sql without CORS;
78
78
- Compact codebase;
@@ -82,22 +82,22 @@ Obtaining an answer of
82
82
83
83
# Security Features
84
84
85
-
*[**Authentication**](documentation/security.md#authentication) can be configured
86
-
* on the client, either using HTTP Basic Authentication or specifying the credentials in the request;
87
-
* on the server, either by specifying credentials (also with hashed passwords) or providing a query to look them up in the db itself;
88
-
* customizable `Not Authorized` error code (if 401 is not optimal)
89
-
* A database can be opened in [**read-only mode**](documentation/security.md#read-only-databases) (only queries will be allowed);
90
-
* It's possible to enforce using [**only stored statements**](documentation/security.md#stored-statements-to-prevent-sql-injection), to avoid some forms of SQL injection and receiving SQL from the client altogether;
91
-
*[**CORS Allowed Origin**](documentation/security.md#cors-allowed-origin) can be configured and enforced;
92
-
* It's possible to [**bind**](documentation/security.md#binding-to-a-network-interface) to a network interface, to limit access.
85
+
-[**Authentication**](documentation/security.md#authentication) can be configured
86
+
- on the client, either using HTTP Basic Authentication or specifying the credentials in the request;
87
+
- on the server, either by specifying credentials (also with hashed passwords) or providing a query to look them up in the db itself;
88
+
- customizable `Not Authorized` error code (if 401 is not optimal)
89
+
- A database can be opened in [**read-only mode**](documentation/security.md#read-only-databases) (only queries will be allowed);
90
+
- It's possible to enforce using [**only stored statements**](documentation/security.md#stored-statements-to-prevent-sql-injection), to avoid some forms of SQL injection and receiving SQL from the client altogether;
91
+
-[**CORS Allowed Origin**](documentation/security.md#cors-allowed-origin) can be configured and enforced;
92
+
- It's possible to [**bind**](documentation/security.md#binding-to-a-network-interface) to a network interface, to limit access.
93
93
94
94
# Design Choices
95
95
96
96
Some design choices:
97
97
98
-
* Very thin layer over SQLite. Errors and type translation, for example, are those provided by the SQLite driver;
99
-
* Doesn't include HTTPS, as this can be done easily (and much more securely) with a [reverse proxy](documentation/security.md#use-a-reverse-proxy-if-going-on-the-internet);
100
-
* Doesn't support SQLite extensions, to improve portability.
98
+
- Very thin layer over the database. Errors and type translation, for example, are those provided by the db driver;
99
+
- Doesn't include HTTPS, as this can be done easily (and much more securely) with a [reverse proxy](documentation/security.md#use-a-reverse-proxy-if-going-on-the-internet);
100
+
- Doesn't support SQLite/DuckDB extensions, to improve portability.
101
101
102
102
# Contacts and Support
103
103
@@ -112,7 +112,8 @@ Many thanks and all the credits to these awesome projects:
Copy file name to clipboardExpand all lines: ROAD_TO_WS4SQL.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,27 +5,35 @@ The version in this branch is a work in progress to slowly add features and (unf
5
5
# Changes
6
6
7
7
- SQLite is embedded via [mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) and CGO. Should be way faster.
8
+
- Support for DuckDB (see below).
8
9
- Target platforms (because of CGO) are now 6 (`win/amd64`, `macos/amd64`, `macos/arm64`, `linux/amd64`, `linux/arm64`, `linux/arm6`).
9
-
-[**BREAKING**] When running the app, the config files must be specified on the command line, the file paths cannot be used anymore (there). This is described in the "Migration" section below. The file path is in the config file.
10
+
-[**BREAKING CHANGE**] When running the app, the config files must be specified on the command line, the file paths cannot be used anymore (there). This is described in the "Migration" section below. The file path is in the config file.
10
11
- The only exception is a "simple case" to serve a file path without any config. This can be done with the new `--quick-db` parameter.
12
+
- Fail fast if the request is empty, don't even attempt to authenticate
11
13
12
14
# Migration
13
15
14
16
- For any `--db` and `--mem-db` switch that was used, an explicit YAML config file must be created. The format is the same, but there is a new section at the beginning:
17
+
15
18
```yaml
16
19
database:
17
-
type: SQLITE #Only SQLITE for now. If omitted, defaults to SQLITE
18
-
inMemory: false # If type = SQLITE. The db is a memory one? If omitted, defaults to false
19
-
path: ".../test.db"# If type = SQLITE. The db file path.
20
-
id: test # If omitted and !inMemory, calculates it from the file name (if type = SQLITE)
20
+
type: SQLITE # SQLITE or DUCKDB. If omitted, defaults to SQLITE
21
+
inMemory: false # If type = SQLITE|DUCKDB. The db is a memory one? If omitted, defaults to false
22
+
path: ".../test.db"# If type = SQLITE|DUCKDB. The db file path.
23
+
id: test # If omitted and !inMemory, calculates it from the file name (if type = SQLITE|DUCKDB)
21
24
disableWALMode: false # If type = SQLITE. Same as before, but moved here.
22
25
readOnly: false # Same as before, but moved here.
23
26
```
24
27
28
+
# Specific to DuckDB
29
+
30
+
- `noFail` is not supported.
31
+
- Placeholders for named parameters are `$VAL`, not `:VAL` as in SQLite.
32
+
- As DuckDB does not support read-only transactions, when `readOnly` is specified the requests won't be processed in a transaction.
33
+
25
34
# Roadmap
26
35
27
36
1. Support mariadb/mysql
28
-
1. Support duckdb (and iron out all the incompatibilities)
0 commit comments