-
Notifications
You must be signed in to change notification settings - Fork 567
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
Accessing rows_before_limit information #292
Comments
Same requirement for the progress data. |
I'll add this feature same as progress/logs/events. See Context options. PS: @lingpeng0314 progress is supported in V2 |
Done |
How could I get this data? Can you help me out? |
here's an example of using context options: var total uint64
ctxWProfile := clickhouse.Context(ctx, clickhouse.WithProfileInfo(func(info *clickhouse.ProfileInfo) {
if info != nil {
total = info.RowsBeforeLimit
}
}))
rows, err := db.QueryContext(ctxWProfile, query, params...) // db is *sql.DB
// total now contains the "rows before limit" info |
Hey,
i would like to access the “rows before limit”-number for select-queries with LIMIT.
In JSON format, the value is returned as “rows_before_limit_at_least”: https://clickhouse.tech/docs/en/interfaces/formats/#json
In native ClickHouse protocol, the “rows before limit”-number is returned from the server in a server profileInfo packet, and is already decoded, but not stored alongside with the rows-result.
This change adds the profileinfo result into the rows-struct for later use.
https://github.com/ClickHouse/clickhouse-go/blob/master/rows.go
Now the “rows before limit”-number can then be fetched from outside the package via this reflect-code:
This is for sure not beautiful.
But without further modification of the package, it is the only way to access these values.
Is there a reason why this information is not accessible right now?
The sql.Rows Interface does not support returning values like this, but the clickhouse-go package could provide a function that accepts the sql.Rows and returns the values?
Any thoughts on this?
Thanks!
The text was updated successfully, but these errors were encountered: