@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.
Files changed (2) hide show
  1. package/README.md +36 -12
  2. 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), a deterministic SQL static analyzer and
4
- advisor (validity, anti-patterns, rewrites, index and schema advice) and query-equivalence checker
5
- for Postgres, MySQL, MariaDB, SQLite, SQL Server, and DuckDB.
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
- Pass `--dialect postgres|mysql|mariadb|sqlite|mssql|duckdb` (default postgres), `--schema <ddl-file>` for
30
- column and type aware checks, and `--key <api-key>` for higher rate limits. If you have the query's
31
- `EXPLAIN` output, pass it with `--explain <file>`: index findings are then confirmed or dismissed by
32
- what the planner did. The schema and the plan are tokenized too.
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, `4` usage error.
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. A query that does not parse is reported on
40
- your machine and nothing is sent. A query that holds text the tokenizer cannot replace is not sent
41
- unless you pass `--allow-raw`.
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`. Supported: linux x64 and arm64, macOS x64 and arm64, Windows x64.
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.10",
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.10",
37
- "@sqlike/cli-darwin-x64": "0.4.10",
38
- "@sqlike/cli-linux-arm64": "0.4.10",
39
- "@sqlike/cli-linux-x64": "0.4.10",
40
- "@sqlike/cli-win32-x64": "0.4.10"
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
  }