百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
X

xk6-sql

> 编程语言
开源

使用 k6 测试中的 SQL 数据库。

190 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

使用 k6 测试中的 SQL 数据库。

xk6-sql

Use SQL databases from k6 tests.

xk6-sql is a Grafana k6 extension that enables the use of SQL databases in k6 tests.

Check out the API documentation here. The TypeScript declaration file can be downloaded from here.

To use the TypeScript declaration file in your IDE (e.g. Visual Studio Code), you need to create a jsconfig.json (or tsconfig.json) file with the following content:

json
{
  "compilerOptions": {
    "target": "ES6",
    "module": "ES6",
    "paths": {
      "k6/x/sql": ["./typings/xk6-sql/index.d.ts"]
    }
  }
}

You will need to update the TypeScript declaration file location in the example above to where you downloaded it.

Usage

To use the xk6-sql API, the k6/x/sql module and the driver module corresponding to the database type should be imported. In the example below, k6/x/sql/driver/ramsql is the RamSQL database driver module.

The driver module exports a driver ID. This driver identifier should be used to identify the database driver to be used in the API functions.

example

…

Build

The xk6 build tool can be used to build a k6 that will include xk6-sql extension and database drivers.

[!IMPORTANT] In the command line bellow, xk6-sql-driver-ramsql is just an example, it should be replaced with the database driver extension you want to use. For example use --with github.com/grafana/xk6-sql-driver-mysql to access MySQL databases.

bash
xk6 build --with github.com/grafana/xk6-sql@latest --with github.com/grafana/xk6-sql-driver-ramsql

For more build options and how to use xk6, check out the xk6 documentation.

Supported RDBMSs includes: mysql, postgres, sqlite3, sqlserver, azuresql, clickhouse.

Check the xk6-sql-driver GitHub topic to discover database driver extensions.

Drivers

To use the xk6-sql extension, one or more database driver extensions should also be embedded. Database driver extension names typically start with the prefix xk6-sql-driver- followed by the name of the database, for example xk6-sql-driver-mysql is the name of the MySQL database driver extension.

For easier discovery, the xk6-sql-driver topic is included in the database driver extensions repository. The xk6-sql-driver GitHub topic search therefore lists the available driver extensions.

Create driver

Check the grafana/xk6-sql-driver-ramsql template repository to create a new driver extension. This is a working driver extension with instructions in its README for customization.

Postgres driver extension and MySQL driver extension are also good examples.

Feedback

If you find the xk6-sql extension useful, please star the repo. The number of stars will affect the time allocated for maintenance.

Contribute

If you want to contribute or help with the development of xk6-sql, start by reading CONTRIBUTING.md.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Gok6sqlxk6

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言