Skip to content

Commit 023fee9

Browse files
committed
Fix example in readme
1 parent 4738a5e commit 023fee9

File tree

1 file changed

+11
-46
lines changed

1 file changed

+11
-46
lines changed

README.md

Lines changed: 11 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
<a href="https://chdb.fly.dev" target="_blank">
2-
<img src="https://avatars.githubusercontent.com/u/132536224" width=130 />
3-
</a>
1+
<img src="https://avatars.githubusercontent.com/u/132536224" width=130 />
42

53
[![chDB-node](https://github.com/chdb-io/chdb-node/actions/workflows/chdb-node-test.yml/badge.svg)](https://github.com/chdb-io/chdb-node/actions/workflows/chdb-node-test.yml)
64

@@ -9,53 +7,20 @@
97

108
### Status
119

12-
- experimental, unstable, subject to changes
13-
- requires [`libchdb`](https://github.com/chdb-io/chdb) on the system
14-
- :wave: _C/Node developer? Jump in and help us evolve this prototype into a stable module!_
10+
- Experimental bindings
11+
- Requires [`libchdb`](https://github.com/chdb-io/chdb) on the system
1512

16-
<br>
13+
### Build
1714

18-
### Examples
19-
20-
#### Query Constructor
21-
```javascript
22-
const chdb = require("chdb-node");
23-
24-
// Query (ephemeral)
25-
const db = new chdb.db("CSV") // format
26-
var result = db.query("SELECT version()");
27-
console.log(result) // 23.10.1.1
28-
29-
// Query Session (persistent)
30-
const dbdisk = new chdb.db("CSV", "/tmp/mysession") // format, storage path
31-
dbdisk.session("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'");
32-
var result = dbdisk.session("SELECT hello()", "TabSeparated"); // optional format override
33-
console.log(result) // chDB
15+
```bash
16+
npm run libchdb
17+
npm install
18+
npm build
19+
npm run test
3420
```
3521

36-
#### Query _(query, format)_
37-
```javascript
38-
const chdb = require("chdb-node").chdb;
39-
var result = chdb.Execute("SELECT version()", "CSV");
40-
console.log(result) // 23.10.1.1
41-
```
22+
### Examples
4223

43-
#### Session _(query, *format, *path)_
44-
```javascript
45-
const chdb = require("chdb-node").chdb;
46-
chdb.Session("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'")
47-
var result = = chdb.Session("SELECT hello();")
48-
console.log(result) // chDB
49-
```
24+
See [example.js](example.js).
5025

51-
> ⚠️ Sessions persist table data to disk. You can specify `path` to implement auto-cleanup strategies:
52-
```javascript
53-
const temperment = require("temperment");
54-
const tmp = temperment.directory();
55-
chdb.Session("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'", "CSV", tmp)
56-
var result = = chdb.Session("SELECT hello();")
57-
console.log(result) // chDB
58-
tmp.cleanup.sync();
59-
```
6026

61-
<br>

0 commit comments

Comments
 (0)