Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/auxten/chdb-server
Standalone chDB server by chdb-go
https://github.com/auxten/chdb-server
chdb clickhouse golang
Last synced: 2 months ago
JSON representation
Standalone chDB server by chdb-go
- Host: GitHub
- URL: https://github.com/auxten/chdb-server
- Owner: auxten
- License: apache-2.0
- Created: 2024-05-25T11:49:07.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-27T08:00:41.000Z (8 months ago)
- Last Synced: 2024-10-12T10:07:03.954Z (3 months ago)
- Topics: chdb, clickhouse, golang
- Language: HTML
- Homepage:
- Size: 196 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chDB Server
This project is a Go-based web server that integrates with the [chDB-go](https://github.com/chdb-io/chdb-go) and provides a web interface for executing database queries. It embeds the static file `play.html` directly within the binary for easy distribution and deployment.
![chDB Server](doc/demo.png)
## Features
- **Query Execution**: Allows users to execute queries against a CHDB database.
- **Session Management**: Persists the database connection across multiple queries.
- **Static Content**: Serves a static HTML file (`play.html`) embedded within the executable.## Prerequisites
Before you start, ensure you have the following installed:
- Go 1.16 or higher
- libchdb```bash
curl -sL https://lib.chdb.io | bash
```## Installation
1. Go Install
```bash
go install github.com/auxten/chdb-server@latest
$GOPATH/bin/chdb-server
```2. Build from source
```bash
git clone https://github.com/auxten/chdb-server.git
make build
./chdb-server
```
### Session Path
You can configure the server by setting the following environment variables before running the server:- DATA_PATH: Specifies the directory path for CHDB session data. Defaults to .chdb_data if not set.
## Usage
Open your browser and navigate to `http://localhost:8123` to start querying any data.
#### Create a new database
```sql
CREATE TABLE users (uid Int16, name String, age Int16) ENGINE=Memory;INSERT INTO users VALUES (1231, 'John', 33);
INSERT INTO users VALUES (6666, 'Ksenia', 48);
INSERT INTO users VALUES (8888, 'Alice', 50);SELECT * FROM users;
```#### Query remote parquet data
```sql
SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID)
FROM url('https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_0.parquet') GROUP BY RegionID ORDER BY c DESC LIMIT 10
```