Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grafana/xk6-sql-driver-clickhouse
xk6-sql driver extension for ClickHouse database support
https://github.com/grafana/xk6-sql-driver-clickhouse
xk6 xk6-sql-driver
Last synced: 3 days ago
JSON representation
xk6-sql driver extension for ClickHouse database support
- Host: GitHub
- URL: https://github.com/grafana/xk6-sql-driver-clickhouse
- Owner: grafana
- License: agpl-3.0
- Created: 2024-10-17T15:13:39.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-05T14:46:25.000Z (about 2 months ago)
- Last Synced: 2024-12-02T07:41:02.801Z (20 days ago)
- Topics: xk6, xk6-sql-driver
- Language: Go
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# xk6-sql-driver-clickhouse
Database driver extension for [xk6-sql](https://github.com/grafana/xk6-sql) k6 extension to support ClickHouse database.
## Example
```JavaScript file=examples/example.js
import sql from "k6/x/sql";
import driver from "k6/x/sql/driver/clickhouse";const db = sql.open(driver, "clickhouse://127.0.0.1:19000");
export function setup() {
db.exec(`CREATE TABLE IF NOT EXISTS hits_by_user_url
(
UserID UInt32,
URL String,
EventTime DateTime
)
ENGINE = MergeTree
PRIMARY KEY (UserID, URL)
ORDER BY (UserID, URL, EventTime)
SETTINGS index_granularity = 8192, index_granularity_bytes = 0;`);
}export function teardown() {
db.close();
}export default function () {
db.exec(`INSERT INTO hits_by_user_url
(UserID, URL, EventTime)
SELECT * FROM generateRandom('UserID UInt32, URL String, EventTime DateTime')
LIMIT 100;`);
}
```## Usage
Check the [xk6-sql documentation](https://github.com/grafana/xk6-sql) on how to use this database driver.