lakeql 0.1.8 → 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 +57 -61
- package/dist/bin.js +60 -8080
- package/dist/chunk-32PE6IK4.js +20803 -0
- package/dist/{chunk-5K5JMJ2M.js → chunk-3WUY56UD.js} +682 -3
- package/dist/chunk-LWF5FKHB.js +1175 -0
- package/dist/{chunk-TFD5RFKB.js → chunk-WGHR35QU.js} +426 -4
- package/dist/cloudflare.d.ts +1 -1
- package/dist/cloudflare.js +5 -4
- package/dist/{geo-backend-TSQJWAAB.js → geo-backend-WYCTLPNS.js} +1 -1
- package/dist/index.d.ts +581 -338
- package/dist/index.js +4 -3
- package/dist/node.d.ts +1 -1
- package/dist/node.js +48 -9
- package/dist/window-backend-OECETVJ2.js +905 -0
- package/package.json +9 -9
- package/dist/chunk-MXGEAVHL.js +0 -11381
package/README.md
CHANGED
|
@@ -3,101 +3,97 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/lakeql)
|
|
4
4
|
[](https://github.com/earonesty/lakeql/blob/main/LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
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.
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
correctly or rejects it with a typed error — it won't return quietly-wrong rows.
|
|
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.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
## Install
|
|
14
15
|
|
|
15
16
|
```sh
|
|
16
17
|
npm install lakeql
|
|
17
18
|
```
|
|
18
19
|
|
|
19
|
-
##
|
|
20
|
+
## Run a SQL Query
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
```sh
|
|
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"
|
|
26
|
+
```
|
|
27
|
+
|
|
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:
|
|
22
33
|
|
|
23
34
|
```ts
|
|
24
|
-
import { createLake, httpStore
|
|
35
|
+
import { createLake, httpStore } from "lakeql/node";
|
|
36
|
+
|
|
37
|
+
const lake = createLake({
|
|
38
|
+
store: httpStore({ baseUrl: "https://example.com/data" }),
|
|
39
|
+
});
|
|
25
40
|
|
|
26
|
-
const
|
|
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
|
+
```
|
|
48
|
+
|
|
49
|
+
Or use the builder API:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createLake, gt, httpStore } from "lakeql/node";
|
|
53
|
+
|
|
54
|
+
const lake = createLake({
|
|
55
|
+
store: httpStore({ baseUrl: "https://example.com/data" }),
|
|
56
|
+
});
|
|
27
57
|
|
|
28
58
|
const rows = await lake
|
|
29
59
|
.path("sales.parquet")
|
|
30
|
-
.select(["store_id", "amount"])
|
|
60
|
+
.select(["store_id", "region", "amount"])
|
|
31
61
|
.where(gt("amount", 100))
|
|
32
62
|
.limit(100)
|
|
33
63
|
.toArray();
|
|
34
64
|
```
|
|
35
65
|
|
|
36
|
-
Inside a Cloudflare Worker,
|
|
66
|
+
Inside a Cloudflare Worker, read from R2:
|
|
37
67
|
|
|
38
68
|
```ts
|
|
39
69
|
import { createLake, r2Store } from "lakeql/cloudflare";
|
|
40
70
|
|
|
41
71
|
export default {
|
|
42
72
|
async fetch(_req: Request, env: { DATA: R2Bucket }) {
|
|
43
|
-
const lake = createLake({
|
|
44
|
-
|
|
45
|
-
budget: { maxOutputRows: 1000, maxConcurrentReads: 4 },
|
|
46
|
-
});
|
|
47
|
-
const rows = await lake.path("sales.parquet").limit(100).toArray();
|
|
48
|
-
return Response.json(rows);
|
|
73
|
+
const lake = createLake({ store: r2Store(env.DATA) });
|
|
74
|
+
return Response.json(await lake.path("sales.parquet").limit(100).toArray());
|
|
49
75
|
},
|
|
50
76
|
};
|
|
51
77
|
```
|
|
52
78
|
|
|
53
|
-
|
|
79
|
+
## Entry Points
|
|
54
80
|
|
|
55
|
-
|
|
56
|
-
import { loadIcebergTable, eq } from "lakeql/node";
|
|
57
|
-
|
|
58
|
-
const table = await loadIcebergTable({
|
|
59
|
-
store: httpStore({ baseUrl: "https://example.com/warehouse" }),
|
|
60
|
-
metadataPath: "places/metadata/v2.metadata.json",
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const plan = table.planFiles({ ref: "main", where: eq("country", "US") });
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Entry points
|
|
67
|
-
|
|
68
|
-
| Import | Adds |
|
|
81
|
+
| Import | Use it for |
|
|
69
82
|
| --- | --- |
|
|
70
|
-
| `lakeql` |
|
|
71
|
-
| `lakeql/node` |
|
|
72
|
-
| `lakeql/cloudflare` |
|
|
73
|
-
|
|
74
|
-
## CLI
|
|
75
|
-
|
|
76
|
-
A global install adds a `lakeql` command for quick local queries:
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
npm install -g lakeql
|
|
80
|
-
lakeql query --path sales.parquet --sql "select region, sum(amount) as revenue from input group by region order by revenue desc"
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## What it supports
|
|
84
|
-
|
|
85
|
-
lakeql aims to read supported Parquet and Iceberg features correctly and reject
|
|
86
|
-
unsupported table semantics explicitly. See the
|
|
87
|
-
[compatibility matrix](https://github.com/earonesty/lakeql/blob/main/docs/compatibility.md)
|
|
88
|
-
and [unsupported-but-detected](https://github.com/earonesty/lakeql/blob/main/docs/unsupported.md).
|
|
89
|
-
Object-store adapters (`httpStore`, `s3Store`, `r2Store`) use HTTP range reads by
|
|
90
|
-
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. |
|
|
91
86
|
|
|
92
87
|
## Documentation
|
|
93
88
|
|
|
94
|
-
Full
|
|
95
|
-
[
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
[
|
|
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)
|
|
101
97
|
|
|
102
98
|
## License
|
|
103
99
|
|