Skip to content

Support clickhouse v2 #1261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

kokizzu
Copy link

@kokizzu kokizzu commented Apr 17, 2025

fixes #942

context: clickhouse-go v1 already deprecated, there wont be any new features of clickhouse will be supported, only critical fix, clickhouse/v2 meanwhile always updated with latest clickhouse new features.

from official documentation: v1 of the driver is deprecated and will not reach feature updates or support for new ClickHouse types. Users should migrate to v2, which offers superior performance.

previous PR not sure why the pull bot cleaned my commit #1245

@dhui

@dhui
Copy link
Member

dhui commented Apr 17, 2025

@kokizzu There are linter failures. Could you fix them?

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kokizzu Thanks for the PR! I also have another request.

@@ -9,6 +9,7 @@ import (
"strings"
"time"

"github.com/ClickHouse/clickhouse-go/v2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a v2 db driver similar to how we use pgxv4 and pgxv5? That way users can decide when to migrate themselves.

Copy link
Author

@kokizzu kokizzu Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think it's possible, clickhouse v2 autoregister as "clickhouse" same as v1 (that already deprecated)
while pgx it using different name "pgx5"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally green btw @dhui

@@ -33,12 +33,12 @@ var (
func clickhouseConnectionString(host, port, engine string) string {
if engine != "" {
return fmt.Sprintf(
"clickhouse://%v:%v?username=user&password=password&database=db&x-multi-statement=true&x-migrations-table-engine=%v&debug=false",
"clickhouse://%v:%v/db?username=user&password=password&x-multi-statement=true&x-migrations-table-engine=%v&debug=false",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one needed at least until this one merged:
ClickHouse/clickhouse-go#1541

ref: ClickHouse/clickhouse-go#757

other related issue: #380

@coveralls
Copy link

coveralls commented Apr 18, 2025

Coverage Status

coverage: 56.33% (+0.01%) from 56.319%
when pulling 09a326d on kokizzu:support-clickhouse-v2
into 9023d66 on golang-migrate:master.

Copy link
Member

@dhui dhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kokizzu Thanks for fixing tests and linter issues! Overall this PR LGTM. Once you remove the docker changes, we can merge.

@@ -64,7 +63,7 @@ type DockerContainer struct {
Cmd []string
ContainerId string
ContainerName string
ContainerJSON dockertypes.ContainerJSON
ContainerJSON dockercontainer.InspectResponse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you back out these changes? The testing package is deprecated in favor of dktest. This is only kept in case users were still using it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this causes linter red

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just reverted and got this:
image

Copy link
Member

@dhui dhui Apr 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use //nolint:staticcheck to ignore these false positives for now. I'm not sure what's different in CI since I'm not getting these warnings locally.

EDIT: It's probably because of the docker version upgrade from v27 to v28. I'd back out that change in go.mod first

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downgrading clickhouse-go/v2 version then, because it was needed by clickhouse/v2

Copy link
Author

@kokizzu kokizzu Apr 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not possible, all related to clickhouse broken if downgrading

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kokizzu Use clickhouse v2.32.2 to stay on docker v27

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhui cannot, all related to clickhouse broken if downgrading to that version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump clickhouse-go to v2
3 participants