Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chdb-io/chdb-bun
bun.sh bindings for chDB, an embedded SQL Engine powered by ClickHouse
https://github.com/chdb-io/chdb-bun
bun chdb clickhouse ffi-bindings
Last synced: about 2 months ago
JSON representation
bun.sh bindings for chDB, an embedded SQL Engine powered by ClickHouse
- Host: GitHub
- URL: https://github.com/chdb-io/chdb-bun
- Owner: chdb-io
- License: apache-2.0
- Created: 2023-05-08T20:19:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-30T04:33:26.000Z (12 months ago)
- Last Synced: 2024-03-02T16:37:52.686Z (10 months ago)
- Topics: bun, chdb, clickhouse, ffi-bindings
- Language: C
- Homepage: https://chdb.io
- Size: 61.5 KB
- Stars: 6
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![chDB-bun](https://github.com/chdb-io/chdb-bun/actions/workflows/bun-test.yml/badge.svg)](https://github.com/chdb-io/chdb-bun/actions/workflows/bun-test.yml)
# chdb-bun
Experimental [chDB](https://github.com/chdb-io/chdb) FFI bindings for the [bun runtime](https://bun.sh)
### Status- experimental, unstable, subject to changes
- requires [`libchdb`](https://github.com/chdb-io/chdb) on the system
- requires `gcc` or `clang`#### Build binding
```bash
bun run build
bun run example.ts
```#### Usage
#### Query(query, *format) (ephemeral)
```javascript
import { query } from 'chdb-bun';// Query (ephemeral)
var result = query("SELECT version()", "CSV");
console.log(result); // 23.10.1.1
```#### Session.Query(query, *format)
```javascript
import { Session } from 'chdb-bun';
const sess = new Session('./chdb-bun-tmp');// Query Session (persistent)
sess.query("CREATE FUNCTION IF NOT EXISTS hello AS () -> 'Hello chDB'", "CSV");
var result = sess.query("SELECT hello()", "CSV");
console.log(result);// Before cleanup, you can find the database files in `./chdb-bun-tmp`
sess.cleanup(); // cleanup session, this will delete the database
```