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 CHANGED
@@ -3,101 +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
- **Query Parquet and Iceberg tables directly from object storage, in TypeScript.**
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
- lakeql is small and dependency-light enough to run in **Cloudflare Workers and
9
- other edge/serverless runtimes**, where DuckDB-WASM or a JVM engine is too heavy.
10
- It streams with HTTP range reads and bounded memory, and either reads a table
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
- **Try it live in your browser:** https://lakeql.com/
14
+ ## Install
14
15
 
15
16
  ```sh
16
17
  npm install lakeql
17
18
  ```
18
19
 
19
- ## Quick start
20
+ ## Run a SQL Query
20
21
 
21
- Read a Parquet file over HTTP — no credentials, runs in Node or on the edge:
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, gt } from "lakeql/node";
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 lake = createLake({ store: httpStore({ baseUrl: "https://example.com/data" }) });
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, reading from R2:
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
- store: r2Store(env.DATA),
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
- Plan an Iceberg table (snapshot selection, partition- and delete-aware pruning):
79
+ ## Entry Points
54
80
 
55
- ```ts
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` | Core query engine, Parquet, Iceberg, and the unified `loadTable` / `planFiles` / `scanRows` / `scanBatches` helpers. |
71
- | `lakeql/node` | Everything in `lakeql`, plus `httpStore` and `s3Store`. |
72
- | `lakeql/cloudflare` | Everything in `lakeql`, plus `r2Store`. |
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 docs, recipes, and the engine contract live in the
95
- [repository](https://github.com/earonesty/lakeql#readme):
96
- [querying Parquet](https://github.com/earonesty/lakeql/blob/main/docs/querying-parquet.md) ·
97
- [querying Iceberg](https://github.com/earonesty/lakeql/blob/main/docs/querying-iceberg.md) ·
98
- [Cloudflare Workers](https://github.com/earonesty/lakeql/blob/main/docs/cloudflare-workers.md) ·
99
- [error codes](https://github.com/earonesty/lakeql/blob/main/docs/errors.md) ·
100
- [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)
101
97
 
102
98
  ## License
103
99