File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 16
16
17
17
<br >
18
18
19
- #### Example
20
- ##### Query _ (query, format)_
19
+ ### Example
20
+ #### Query _ (query, format)_
21
21
``` javascript
22
22
const chdb = require (' chdb-node' );
23
23
var result = chdb .Execute (' SELECT version()' , ' CSV' );
24
24
console .log (result) // 23.6.1.1
25
25
```
26
26
27
- ##### Session _ (query, * format, * path)_
27
+ #### Session _ (query, * format, * path)_
28
28
``` javascript
29
29
const chdb = require (' chdb-node' );
30
30
chdb .Session (" CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'" )
31
31
var result = = chdb .Session (" SELECT hello();" )
32
32
console .log (result) // chDB
33
33
```
34
34
35
- Sessions persist table data to disk. You can specify the ` path ` and ` format ` :
35
+ Sessions persist table data to disk. You can specify ` path ` to implement auto-cleanup strategies :
36
36
``` javascript
37
- chdb .Session (" CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'" , " CSV" , " /tmp/" )
37
+ const temperment = require (' temperment' );
38
+ const tmp = temperment .directory ();
39
+ chdb .Session (" CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'" , " CSV" , tmp)
40
+ var result = = chdb .Session (" SELECT hello();" )
41
+ console .log (result) // chDB
42
+ tmp .cleanup .sync ();
38
43
```
39
44
40
45
⚠️ _ Session folders are persistent and NOT automatically cleaned_
You can’t perform that action at this time.
0 commit comments