-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from samof76/add-clickhouse-support
Adding clickhouse support in k6.
- Loading branch information
Showing
4 changed files
with
116 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import sql from 'k6/x/sql'; | ||
|
||
const db = sql.open("clickhouse", "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;`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.