@sqlike/cli 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -12
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @sqlike/cli
|
|
2
2
|
|
|
3
|
-
Command-line client for [sqlike](https://sqlike.com)
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Command-line client for [sqlike](https://sqlike.com). It checks a SQL query for errors and
|
|
4
|
+
anti-patterns, suggests rewrites and indexes, and checks that two queries return the same results.
|
|
5
|
+
It supports Postgres, MySQL, MariaDB, SQLite, SQL Server and DuckDB.
|
|
6
6
|
|
|
7
7
|
This package is a remote client. It tokenizes your SQL on your machine, which replaces identifiers
|
|
8
8
|
and literals with placeholders, and sends only the tokenized query to the sqlike API. There is no
|
|
@@ -26,25 +26,49 @@ echo 'SELECT * FROM users WHERE id IN (SELECT uid FROM bans)' \
|
|
|
26
26
|
sqlike diff before.sql after.sql --schema schema.sql
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
`check` takes one or more files, or `-` for stdin. `diff` takes two files.
|
|
30
|
+
|
|
31
|
+
Both commands accept:
|
|
32
|
+
|
|
33
|
+
- `--dialect`: `postgres` (the default), `mysql`, `mariadb`, `sqlite`, `mssql` or `duckdb`.
|
|
34
|
+
- `--schema <ddl-file>`: the `CREATE TABLE` and `CREATE INDEX` statements, for column and type
|
|
35
|
+
checks.
|
|
36
|
+
- `--key <api-key>`: an API key, for higher rate limits. The `SQLIKE_API_KEY` environment variable
|
|
37
|
+
does the same and stays out of your shell history.
|
|
38
|
+
|
|
39
|
+
`check` also accepts:
|
|
40
|
+
|
|
41
|
+
- `--stats <json-file>`: row counts per table, for example `{"orders": 2000000}`. Severity and
|
|
42
|
+
index advice then follow table size.
|
|
43
|
+
- `--explain <file>`: the query's `EXPLAIN` output. Index findings are then confirmed or dismissed
|
|
44
|
+
by what the planner did. `sqlike check --help` lists the format for each database.
|
|
45
|
+
- `--fail-on never|warn|block`: the lowest result that fails the command. The default is `block`.
|
|
46
|
+
- `--json`: the report as JSON.
|
|
47
|
+
|
|
48
|
+
`diff` also accepts:
|
|
49
|
+
|
|
50
|
+
- `--columns by-name`: for code that reads columns by name. A moved column is then a note. By
|
|
51
|
+
default columns are compared in order, so a moved column is a difference.
|
|
52
|
+
- `--ignore order`: for code that does not depend on the order of the rows.
|
|
53
|
+
- `--fail-on names,position,order`: exit with `1` when the queries differ only in one of these.
|
|
33
54
|
|
|
34
55
|
Exit codes: `0` clean or equivalent, `1` a warning (with `--fail-on warn`) or differs, `2` a
|
|
35
|
-
blocking finding or undecided, `3` the check could not run
|
|
56
|
+
blocking finding or undecided, `3` the check could not run or the two queries cannot be compared,
|
|
57
|
+
`4` usage error.
|
|
36
58
|
|
|
37
59
|
### Privacy
|
|
38
60
|
|
|
39
|
-
A query is tokenized before it leaves your machine.
|
|
40
|
-
|
|
41
|
-
|
|
61
|
+
A query is tokenized before it leaves your machine. So are the schema, the plan and the table
|
|
62
|
+
names in the row counts. A query that does not parse is reported on your machine and nothing is
|
|
63
|
+
sent. A query that holds text the tokenizer cannot replace is not sent. `check` sends it as typed
|
|
64
|
+
only if you pass `--allow-raw`.
|
|
42
65
|
|
|
43
66
|
## How it ships
|
|
44
67
|
|
|
45
68
|
The CLI is a native binary. Each platform's binary is published as its own optional-dependency
|
|
46
69
|
package (`@sqlike/cli-linux-x64`, `@sqlike/cli-darwin-arm64`, and so on), so npm installs only the
|
|
47
|
-
one matching your OS and CPU. No install scripts run, so it works with `--ignore-scripts`.
|
|
70
|
+
one matching your OS and CPU. No install scripts run, so it works with `--ignore-scripts`.
|
|
71
|
+
Supported: Linux x64 and arm64, macOS x64 and arm64, Windows x64.
|
|
48
72
|
|
|
49
73
|
## License
|
|
50
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlike/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"description": "Lints SQL and checks that a rewrite still returns the same rows. Postgres, MySQL, MariaDB, SQLite, SQL Server and DuckDB. Queries are tokenized before they leave your machine.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@sqlike/cli-darwin-arm64": "0.4.
|
|
37
|
-
"@sqlike/cli-darwin-x64": "0.4.
|
|
38
|
-
"@sqlike/cli-linux-arm64": "0.4.
|
|
39
|
-
"@sqlike/cli-linux-x64": "0.4.
|
|
40
|
-
"@sqlike/cli-win32-x64": "0.4.
|
|
36
|
+
"@sqlike/cli-darwin-arm64": "0.4.11",
|
|
37
|
+
"@sqlike/cli-darwin-x64": "0.4.11",
|
|
38
|
+
"@sqlike/cli-linux-arm64": "0.4.11",
|
|
39
|
+
"@sqlike/cli-linux-x64": "0.4.11",
|
|
40
|
+
"@sqlike/cli-win32-x64": "0.4.11"
|
|
41
41
|
}
|
|
42
42
|
}
|