Releases: ClickHouse/clickhouse-go
v2.40.1
What's Changed
Bug fixes 🐛
- fix:
database/sql
Nullable(JSON) string scan by @SpencerTorres in #1625
Full Changelog: v2.40.0...v2.40.1
v2.40.0
What's Changed
Enhancements 🎉
- support
database/sql
scanning json intostring
/[]byte
/json.RawMessage
by @SpencerTorres in #1623
Bug fixes 🐛
- fix: json v1 encoding/decoding for prefixed types by @SpencerTorres in #1622
- fix: Nullable base types with prefix by @SpencerTorres in #1624
Other Changes 🛠
- Bump github.com/docker/docker from 28.3.2+incompatible to 28.3.3+incompatible by @dependabot[bot] in #1621
Full Changelog: v2.39.0...v2.40.0
v2.39.0
What's Changed
Bug fixes 🐛
- Fix
ReadTimeout
so that it applies to each call toconn.Read
not just the first read block by @GeorgeMac in #1616, @SpencerTorres #1617
Read Timeout behavior changes
This bug fix has potential to affect longer running queries, ensure you're setting clickhouse.Options
ReadTimeout
to a reasonable value, and that your context.WithDeadline
is also set to a reasonable value. The read timeout will now be applied to all blocks, previously it was only set for the first block.
New Contributors
- @GeorgeMac made their first contribution in #1616
Full Changelog: v2.38.1...v2.39.0
v2.38.1
What's Changed
Bug fixes 🐛
- fix: build failure due to 32-bit integer overflow on 386 arch by @SpencerTorres in #1616
Full Changelog: v2.38.0...v2.38.1
v2.38.0
What's Changed
Enhancements 🎉
Dynamic
serialization version 3 by @SpencerTorres in #1588JSON
serialization version 3 by @SpencerTorres in #1589- Add
client_protocol_version
param for HTTP interface by @SpencerTorres in #1594 - Add missing interval types by @marcboeker in #1613
Bug fixes 🐛
- fix format function to handle pointer of time.Time by @KimMachineGun in #1559
- Fix variant prefix by @SpencerTorres in #1591
- fix(batch): nested column name parsing #1587 by @RuslanSibgatulin in #1614
Other Changes 🛠
- Bump github.com/andybalholm/brotli from 1.1.1 to 1.2.0 by @dependabot[bot] in #1581
- Bump github.com/docker/docker from 28.2.2+incompatible to 28.3.0+incompatible by @dependabot[bot] in #1583
- Bump go.opentelemetry.io/otel/trace from 1.36.0 to 1.37.0 by @dependabot[bot] in #1584
- Bump github.com/docker/docker from 28.3.0+incompatible to 28.3.1+incompatible by @dependabot[bot] in #1585
- Bump github.com/docker/docker from 28.3.1+incompatible to 28.3.2+incompatible by @dependabot[bot] in #1593
- Bump golang.org/x/net from 0.41.0 to 0.42.0 by @dependabot[bot] in #1595
- add HTTP wait condition for container tests by @SpencerTorres in #1604
- include server revision in block/column parsing by @SpencerTorres in #1605
- Bump github.com/testcontainers/testcontainers-go from 0.37.0 to 0.38.0 by @dependabot[bot] in #1603
- docs: add client configuration options by @shivanshuraj1333 in #1598
- Bump github.com/ClickHouse/ch-go from 0.66.1 to 0.67.0 by @dependabot[bot] in #1609
Upgrades for Dynamic / JSON
Dynamic and JSON were never fully functional in previous versions. If you exceeded the maximum types for Dynamic
, the data would become unreadable since it was encoded as a single SharedVariant
type. Same for JSON, if you exceeded the maximum dynamic paths the data would also become unreadable since it was stored in a SharedData
structure.
In ClickHouse 25.6, a setting was added that abstracts these structures away so that clients don't have to implement them.
To begin using Dynamic and JSON to their fullest ability, upgrade to ClickHouse 25.6 along with clickhouse-go v2.38.0, and enable output_format_native_use_flattened_dynamic_and_json_serialization
in your connection settings. This will allow you to read all Dynamic and JSON data, even the portions that are stored in the SharedVariant and SharedData blobs on the server.
If you are using older versions of ClickHouse, things will continue to work as before (with the previously mentioned limitations).
Feel free to create an issue in the clickhouse-go repository to report any concerns or bugs with this change.
New Contributors
- @KimMachineGun made their first contribution in #1559
- @shivanshuraj1333 made their first contribution in #1598
- @RuslanSibgatulin made their first contribution in #1614
- @marcboeker made their first contribution in #1613
Full Changelog: v2.37.2...v2.38.0
v2.37.2
What's Changed
Other Changes 🛠
- remove dependency on v1, update ch-go by @SpencerTorres in #1580
Full Changelog: v2.37.1...v2.37.2
v2.37.1
What's Changed
Bug fixes 🐛
- Fix Native API HTTP bugs by @SpencerTorres in #1578
- Fixed critical bug with the new HTTP Native API where connections were not being released.
- Also fixed random HTTP 400 errors with large batches over HTTP
Full Changelog: v2.37.0...v2.37.1
v2.37.0
What's Changed
Enhancements 🎉
- Scanning Datetime and Datetime64 into int64 by @vaibhav-kt in #1560
- Supports scanning of Array, IPv4, IPv6, and Map types into Go values that implement the
sql.Scanner
interface. by @zapateo in #1570 - Support HTTP connnections in Native Go interface by @SpencerTorres in #1577 (see details at bottom of release notes!)
Bug fixes 🐛
- fix: Prevent panic on slice map keys by @disq in #1567
- object_json: split JSON tag to remove any trailing omitempty by @dschofie in #1547
- fix: namedValue namedDatevalue usage error by @tosolveit in #1575
- Fix false positives in TestInterfaceArray by @tosolveit in #1572
HTTP in ClickHouse API
This release includes a bug fix / enhancement for the "ClickHouse API" interface. Previously the only way to use HTTP was through the database/sql
interface, but now you can use Protocol: clickhouse.HTTP
in your clickhouse.Open
options.
HTTP still has some limitations to be aware of for things like batch flushing and session context, so be cautious when switching over code to this protocol. Please report any issues you may have with this change. Native protocol shouldn't be affected, but you can downgrade to v2.36.x if you notice any issues.
New Contributors
- @disq made their first contribution in #1567
- @vaibhav-kt made their first contribution in #1560
- @tosolveit made their first contribution in #1572
- @dschofie made their first contribution in #1547
- @zapateo made their first contribution in #1570
Full Changelog: v2.36.0...v2.37.0
v2.36.0
What's Changed
Enhancements 🎉
- Add
Close
function to batch interface by @SpencerTorres in #1566
The batch.Close()
function was added to prevent connections from being leaked by the batch interface. In the previous API, it is possible that an early return (due to return err
or some other cause) would cause the connection to be held until the connection timed out.
Here's an example of using this new function:
batch, err := conn.PrepareBatch(ctx, "INSERT INTO function null('x UInt64') VALUES (1)")
if err != nil { . . . }
// This defer call will make sure the batch is absolutely cleaned up before it falls out of scope.
defer batch.Close()
Users should update their code to call this new function. Depending on your insert logic you may be leaking connections if Send
never gets called.
Full Changelog: v2.35.0...v2.36.0
v2.35.0
What's Changed
Enhancements 🎉
- JWT Authentication by @SpencerTorres in #1538
- Add support for overriding
database
in DSN URL by @kokizzu in #1541
Full Changelog: v2.34.0...v2.35.0