Releases: grafana/xk6-sql
v1.0.0
🎉 xk6-sql v1.0.0
is here!
Modularization
This release contains a major refactoring, the modularization of the previously monolithic xk6-sql
. The database driver integrations have been extracted into separate k6 driver extensions.
Although modularization means a small API modification, it is basically a breaking change!
How it Works
The SQL database driver integration is implemented in a separate k6 extension. The JavaScript API of this extension contains a single default export whose type is JavaScript Symbol and is used to specify the database driver in the xk6-sql API.
The use of the Symbol type is necessary in order to force the import of the driver module.
import sql from "k6/x/sql"
import sqlite3 from "k6/x/sql/sqlite3"
const db = sql.open(sqlite3, "./test.db")
Drivers
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.
During the refactoring, the following k6 SQL database driver extensions were created from the database drivers previously embedded in the xk6-sql extension:
- https://github.com/grafana/xk6-sql-driver-mysql
- https://github.com/grafana/xk6-sql-driver-postgres
- https://github.com/grafana/xk6-sql-driver-sqlite3
- https://github.com/grafana/xk6-sql-driver-azuresql
- https://github.com/grafana/xk6-sql-driver-sqlserver
- https://github.com/grafana/xk6-sql-driver-clickhouse
The following template repository can be used to create a new driver extension: https://github.com/grafana/xk6-sql-driver-ramsql
Solved problems
-
New SQL database type support (integration of new golang database/sql driver) does not require changes to the source code of
xk6-sql
and the release ofxk6-sql
. -
Supporting additional database drivers does not increase the size of
k6
. Since the database drivers are implemented in a separatek6
extension, it is sufficient to embed only the drivers you want to use. -
The SQL database driver integration created by the community can be maintained by the community. Since database drivers are implemented as
k6
extensions, the community can create and maintain driver modules independently of Grafana. -
Drivers may have different requirements. For example, cgo (
CGO_ENABLED
) should only be enabled if a driver needs it. (likesqlite3
). -
From the security perspective, the attack surface is smaller if fewer dependencies are embedded.
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.
xk6 build --with github.com/grafana/xk6-sql@latest --with github.com/grafana/xk6-sql-driver-ramsql@latest
API Compatibility
The xk6-sql
JavaScript API changes in an incompatible way because of the driver parameter type becomes Symbol instead of String.
API documentation
A TypeScript declaration file was created for the xk6-sql
API, from which an API documentation site is generated.
MySQL TLS support
MySQL TLS configuration support has been moved to the driver extension: https://github.com/grafana/xk6-sql-driver-mysql
It is important to note that the MySQL TLS configuration API will change in the future.
v0.4.1
What's Changed
- Change to using sobek instead of goja by @mstoykov in #67
- fix: sqlite3-binding.c error 'pread64' undeclared here by @jt-shippit in #68
- document Clickhouse support by @200Puls in #69
- Support TLS when using the Mysql driver by @surajvshankar in #71
New Contributors
- @jt-shippit made their first contribution in #68
- @200Puls made their first contribution in #69
- @surajvshankar made their first contribution in #71
v0.4.0
What's Changed
- feat: Support Azure Active Directory authentication for Microsoft SQL Server #55 (Thanks to @JBodkin-Amphora)
- feat: Adding clickhouse support in k6 #58 (Thanks to @samof76)
- fix: Critical vulnerability in go net #62 (Thanks to @kempsterc)
v0.3.0
What's Changed
- Updating CI in-line with latest changes in k6 by @javaducky in #52
- Update dependencies to latest by @javaducky in #51
- Change support for mssql to official Microsoft driver by @javaducky in #53
Full Changelog: v0.2.1...v0.3.0
v0.2.1
v0.2.0
What's Changed
- Fixing mssql_test.js example with correct sp_executesql syntax by @leandrodotec in #40
- Upgrade dependencies to address vulnerability by @javaducky in #44
New Contributors
- @leandrodotec made their first contribution in #40
Full Changelog: v0.1.1...v0.2.0
v0.1.1
What's Changed
- fix nil pointer dereference by @ynovytskyy in #37
New Contributors
- @ynovytskyy made their first contribution in #37
Full Changelog: v0.1.0...v0.1.1
v0.1.0
What's Changed
- Update the URL of the Oracle fork in README by @stefnedelchevbrady in #32
- Extension compliance updates by @javaducky in #35
New Contributors
- @stefnedelchevbrady made their first contribution in #32
Full Changelog: v0.0.1...v0.1.0