lakeql 0.1.9 → 0.2.0
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 +56 -73
- package/dist/bin.js +32 -8845
- package/dist/chunk-32PE6IK4.js +20803 -0
- package/dist/{chunk-2XZJK7EF.js → chunk-3WUY56UD.js} +682 -4
- package/dist/{chunk-ZVHJD6R3.js → chunk-LWF5FKHB.js} +1 -1
- package/dist/{chunk-4VJQ56HF.js → chunk-WGHR35QU.js} +3 -1
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +5 -5
- package/dist/{geo-backend-MY6MET3L.js → geo-backend-WYCTLPNS.js} +1 -1
- package/dist/index.d.ts +45 -2
- package/dist/index.js +4 -4
- package/dist/node.d.ts +1 -1
- package/dist/node.js +6 -6
- package/dist/{window-backend-DIMZN7EZ.js → window-backend-OECETVJ2.js} +2 -2
- package/package.json +9 -9
- package/dist/chunk-6XXXYVXT.js +0 -11741
package/README.md
CHANGED
|
@@ -3,114 +3,97 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/lakeql)
|
|
4
4
|
[](https://github.com/earonesty/lakeql/blob/main/LICENSE)
|
|
5
5
|
|
|
6
|
-
LakeQL is a
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
14
|
+
## Install
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
20
|
+
## Run a SQL Query
|
|
27
21
|
|
|
28
22
|
```sh
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
49
|
+
Or use the builder API:
|
|
35
50
|
|
|
36
51
|
```ts
|
|
37
|
-
import { createLake,
|
|
52
|
+
import { createLake, gt, httpStore } from "lakeql/node";
|
|
38
53
|
|
|
39
|
-
const lake = createLake({
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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 |
|
|
81
|
+
| Import | Use it for |
|
|
82
82
|
| --- | --- |
|
|
83
|
-
| `lakeql` |
|
|
84
|
-
| `lakeql/node` |
|
|
85
|
-
| `lakeql/cloudflare` |
|
|
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
|
|
108
|
-
[
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
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
|
|