lakeql 0.1.9 → 0.5.1

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 CHANGED
@@ -3,114 +3,97 @@
3
3
  [![npm](https://img.shields.io/npm/v/lakeql.svg)](https://www.npmjs.com/package/lakeql)
4
4
  [![license](https://img.shields.io/npm/l/lakeql.svg)](https://github.com/earonesty/lakeql/blob/main/LICENSE)
5
5
 
6
- LakeQL is a pure JavaScript analytical query engine for Parquet and Iceberg, designed for
7
- edge runtimes such as Cloudflare Workers. It requires no WASM, no native modules, and
8
- streams large datasets with low memory usage.
6
+ LakeQL is a JavaScript query engine for Parquet and Iceberg data in object
7
+ storage. It runs in Node.js, browsers, Cloudflare Workers, and other JavaScript
8
+ runtimes.
9
9
 
10
- LakeQL runs anywhere JavaScript runs: browsers, Node.js, Cloudflare Workers, and other
11
- edge/serverless environments. It reads directly from object storage, uses bounded
12
- streaming execution, and avoids the startup and deployment cost of DuckDB-WASM, native
13
- modules, or a JVM.
10
+ Use it to query lake data without running a database server or shipping native
11
+ runtime dependencies. LakeQL reads with range requests, streams results, and
12
+ keeps execution bounded for serverless and edge workloads.
14
13
 
15
- Why care:
14
+ ## Install
16
15
 
17
- - Pure JavaScript: no WASM startup cost, no native modules.
18
- - Edge runtime friendly: built for constrained JavaScript runtimes.
19
- - Low-memory streaming execution over Parquet and Iceberg.
20
- - Strict correctness: supported data is read correctly, unsupported semantics are rejected with typed errors.
21
-
22
- Although LakeQL is optimized for portability and memory efficiency rather than raw
23
- throughput, it is competitive with DuckDB-WASM and is faster on several common workloads.
24
- Compare them in-browser at https://lakeql.com/compare.html.
16
+ ```sh
17
+ npm install lakeql
18
+ ```
25
19
 
26
- **Try it live in your browser:** https://lakeql.com/
20
+ ## Run a SQL Query
27
21
 
28
22
  ```sh
29
- npm install lakeql
23
+ npx lakeql query \
24
+ --path sales.parquet \
25
+ --sql "select region, sum(amount) as revenue from input group by region order by revenue desc limit 10"
30
26
  ```
31
27
 
32
- ## Quick start
28
+ Use `--format json`, `--format ndjson`, or `--format csv` to choose the output.
29
+
30
+ ## Query from JavaScript
31
+
32
+ Use SQL strings from application code:
33
+
34
+ ```ts
35
+ import { createLake, httpStore } from "lakeql/node";
36
+
37
+ const lake = createLake({
38
+ store: httpStore({ baseUrl: "https://example.com/data" }),
39
+ });
40
+
41
+ const rows = await lake
42
+ .sql("select store_id, amount from input where amount > $1 limit 100", {
43
+ path: "sales.parquet",
44
+ parameters: [100],
45
+ })
46
+ .toArray();
47
+ ```
33
48
 
34
- Read a Parquet file over HTTP — no credentials, runs in Node or on the edge:
49
+ Or use the builder API:
35
50
 
36
51
  ```ts
37
- import { createLake, httpStore, gt } from "lakeql/node";
52
+ import { createLake, gt, httpStore } from "lakeql/node";
38
53
 
39
- const lake = createLake({ store: httpStore({ baseUrl: "https://example.com/data" }) });
54
+ const lake = createLake({
55
+ store: httpStore({ baseUrl: "https://example.com/data" }),
56
+ });
40
57
 
41
58
  const rows = await lake
42
59
  .path("sales.parquet")
43
- .select(["store_id", "amount"])
60
+ .select(["store_id", "region", "amount"])
44
61
  .where(gt("amount", 100))
45
62
  .limit(100)
46
63
  .toArray();
47
64
  ```
48
65
 
49
- Inside a Cloudflare Worker, reading from R2:
66
+ Inside a Cloudflare Worker, read from R2:
50
67
 
51
68
  ```ts
52
69
  import { createLake, r2Store } from "lakeql/cloudflare";
53
70
 
54
71
  export default {
55
72
  async fetch(_req: Request, env: { DATA: R2Bucket }) {
56
- const lake = createLake({
57
- store: r2Store(env.DATA),
58
- budget: { maxOutputRows: 1000, maxConcurrentReads: 4 },
59
- });
60
- const rows = await lake.path("sales.parquet").limit(100).toArray();
61
- return Response.json(rows);
73
+ const lake = createLake({ store: r2Store(env.DATA) });
74
+ return Response.json(await lake.path("sales.parquet").limit(100).toArray());
62
75
  },
63
76
  };
64
77
  ```
65
78
 
66
- Plan an Iceberg table (snapshot selection, partition- and delete-aware pruning):
67
-
68
- ```ts
69
- import { loadIcebergTable, eq } from "lakeql/node";
70
-
71
- const table = await loadIcebergTable({
72
- store: httpStore({ baseUrl: "https://example.com/warehouse" }),
73
- metadataPath: "places/metadata/v2.metadata.json",
74
- });
75
-
76
- const plan = table.planFiles({ ref: "main", where: eq("country", "US") });
77
- ```
78
-
79
- ## Entry points
79
+ ## Entry Points
80
80
 
81
- | Import | Adds |
81
+ | Import | Use it for |
82
82
  | --- | --- |
83
- | `lakeql` | Core query engine, Parquet, Iceberg, and the unified `loadTable` / `planFiles` / `scanRows` / `scanBatches` helpers. |
84
- | `lakeql/node` | Everything in `lakeql`, plus `httpStore` and `s3Store`. |
85
- | `lakeql/cloudflare` | Everything in `lakeql`, plus `r2Store`. |
86
-
87
- ## CLI
88
-
89
- A global install adds a `lakeql` command for quick local queries:
90
-
91
- ```sh
92
- npm install -g lakeql
93
- lakeql query --path sales.parquet --sql "select region, sum(amount) as revenue from input group by region order by revenue desc"
94
- ```
95
-
96
- ## What it supports
97
-
98
- lakeql aims to read supported Parquet and Iceberg features correctly and reject
99
- unsupported table semantics explicitly. See the
100
- [compatibility matrix](https://github.com/earonesty/lakeql/blob/main/docs/compatibility.md)
101
- and [unsupported-but-detected](https://github.com/earonesty/lakeql/blob/main/docs/unsupported.md).
102
- Object-store adapters (`httpStore`, `s3Store`, `r2Store`) use HTTP range reads by
103
- default; Iceberg writes are append-only.
83
+ | `lakeql` | Query builder, Parquet, Iceberg, in-memory stores, and shared types. |
84
+ | `lakeql/node` | Node.js apps that need HTTP, S3, or filesystem cache helpers. |
85
+ | `lakeql/cloudflare` | Cloudflare Workers apps that read from R2. |
104
86
 
105
87
  ## Documentation
106
88
 
107
- Full docs, recipes, and the engine contract live in the
108
- [repository](https://github.com/earonesty/lakeql#readme):
109
- [querying Parquet](https://github.com/earonesty/lakeql/blob/main/docs/querying-parquet.md) ·
110
- [querying Iceberg](https://github.com/earonesty/lakeql/blob/main/docs/querying-iceberg.md) ·
111
- [Cloudflare Workers](https://github.com/earonesty/lakeql/blob/main/docs/cloudflare-workers.md) ·
112
- [error codes](https://github.com/earonesty/lakeql/blob/main/docs/errors.md) ·
113
- [why not DuckDB-WASM?](https://github.com/earonesty/lakeql/blob/main/docs/why-not-duckdb-wasm.md)
89
+ - [Full README](https://github.com/earonesty/lakeql#readme)
90
+ - [Docs index](https://github.com/earonesty/lakeql/blob/main/docs/README.md)
91
+ - [Examples](https://github.com/earonesty/lakeql/blob/main/docs/examples.md)
92
+ - [Querying Parquet](https://github.com/earonesty/lakeql/blob/main/docs/querying-parquet.md)
93
+ - [SQL guide](https://github.com/earonesty/lakeql/blob/main/docs/sql-dialect.md)
94
+ - [Querying Iceberg](https://github.com/earonesty/lakeql/blob/main/docs/querying-iceberg.md)
95
+ - [Cloudflare Workers](https://github.com/earonesty/lakeql/blob/main/docs/cloudflare-workers.md)
96
+ - [Compatibility matrix](https://github.com/earonesty/lakeql/blob/main/docs/compatibility.md)
114
97
 
115
98
  ## License
116
99