Repository navigation
v0.13.0
This release adds the driver clickhouse, for ClickHouse. No other driver changes for a caller.
New
- ClickHouse. The package
clickhouseruns SQL on ClickHouse through its HTTP interface, measured on ClickHouse 25.3, 25.8 and 26.9. It does not speak the native protocol (D174). The DSN isclickhouse://user:password@host:8123/database, with the keytlsand the port 8443 whentls=true(D177). - Name. The driver registers the name
clickhouse, asClickHouse/clickhouse-godoes, so a program can link only one of the two. - Reading. A query reads
JSONCompactEachRowWithNamesAndTypeswithencoding/json/v2, one token at a time, with six settings on every request: 64-bit integers as numbers, quoted special floats, ISO times, tuples as arrays, the error of a late failure as a marker, and no compression of the answer (D176). - Errors after rows. The server answers HTTP 200 with the first rows, so a late error cannot change the status. The driver reads the marker in the stream, and a status other than 200 is an error even when rows came first. A result that ends with no marker and no end of its rows is cut short, and the error wraps
dbimp.ErrIncomplete. - Parameters. The server binds typed parameters. The driver writes
{pN:Type}in the statement and sendsparam_pNin the query string, with the type chosen from the Go type of the argument. - Cancel. Each statement carries a
query_id. When the context ends, and when the caller closes the rows before the end, the driver sendsKILL QUERY, because a disconnect does not stop a query on 26.9. - Types.
Int128,Int256,UInt128andUInt256are*big.Int.IPv4andIPv6arenetip.Addr.TimeandTime64aretime.Duration.DateTimeandDateTime64aretime.Time. A geometry is a nested[]any, and aVariant, aDynamicand aJSONare the decoded JSON value.docs/TYPES.mdhas two new kinds for the first two (D177).
What a caller must know
BeginTxfails withdbimp.ErrNotSupported, because the server answers everyBEGINwith HTTP 501.UPDATEgoes to the server as written. A server that refuses it answers with its error.ALTER TABLE ... UPDATEworks on each release and runs in the background unless the caller setsmutations_sync=2.RowsAffectedalways fails withdbimp.ErrNotSupported, because the server reports 0 rows for an update and a delete.- A statement with a
FORMATclause fails withdbimp.ErrNotSupported. - A
Tupleand atime.Durationfor aTimecolumn have no Go type to bind. Pass JSON text throughJSONExtract. QueryRowsendsKILL QUERYtoo, becausedatabase/sqlcloses the rows after the first one.- The value of a
Varianthas no member type, aDynamicand the paths of aJSONhave no type, an instant has no zone, and anAggregateFunctionhas no value. - TLS and a cluster are not measured.
Other changes
- The workflow pins
dbmetaat its releasev0.3.0, which publishes the HTTP port of ClickHouse and the userdbmeta_user. - ClickHouse has no flavor. The driver asks
SELECT version()once for each connection.
Tests
CI passed all 32 jobs on the tagged commit, which includes the integration jobs of ClickHouse 25.8 and 26.9. The author also ran the integration tests on ClickHouse 25.3.