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 1616
1717<br >
1818
19- #### Example
20- ##### Query _ (query, format)_
19+ ### Example
20+ #### Query _ (query, format)_
2121``` javascript
2222const chdb = require (' chdb-node' );
2323var result = chdb .Execute (' SELECT version()' , ' CSV' );
2424console .log (result) // 23.6.1.1
2525```
2626
27- ##### Session _ (query, * format, * path)_
27+ #### Session _ (query, * format, * path)_
2828``` javascript
2929const chdb = require (' chdb-node' );
3030chdb .Session (" CREATE FUNCTION IF NOT EXISTS hello AS () -> 'chDB'" )
3131var result = = chdb .Session (" SELECT hello();" )
3232console .log (result) // chDB
3333```
3434
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 :
3636``` 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 ();
3843```
3944
4045⚠️ _ Session folders are persistent and NOT automatically cleaned_
You can’t perform that action at this time.
0 commit comments