-
Notifications
You must be signed in to change notification settings - Fork 577
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
Add support for new JSON type #1430
Comments
Thanks for working on this! I was starting to use the new JSON data type today and err := db.PrepareBatch(context.Background(), "INSERT INTO json_test") you will get the error |
SOLVED: only works by appending Leaving the original below for future readers/googlers... It's also problematic that selecting a This doesn't change when using You can see this in @mshustov's code snippet:
|
Found a bug that prevented enabling |
Keeping this open until we handle the other tasks (it keeps getting auto closed from the PRs) |
Performance benchmarking done for read/write: #1474 (comment) I added a short writeup of the conclusions along with recommendations for users. Perhaps we can copy it to docs at some point |
Hi Spencer, is the issue solved? I still have the error my go client -> github.com/ClickHouse/clickhouse-go/v2 v2.30.0 and I am using a snippet on settings employed (based on this github issue) c.conn, e = clickhouse.Open(&clickhouse.Options{
Addr: []string{c.cfg.URL},
Auth: clickhouse.Auth{
Database: c.cfg.Database,
Username: c.cfg.Username,
Password: c.cfg.Password,
},
ClientInfo: clickhouse.ClientInfo{
Products: []struct {
Name string
Version string
}{
{Name: `sample_app`, Version: `0.1.0`},
},
},
Debugf: func(format string, args ...interface{}) {
fmt.Printf(format, args...)
},
TLS: &tls.Config{
InsecureSkipVerify: true,
},
Settings: clickhouse.Settings{
"allow_experimental_json_type": 1,
"output_format_json_quote_64bit_integers": 0,
"output_format_native_write_json_as_string": 1,
},
}) Thanks |
@quoeamaster JSON type supported from 2.30.1, see https://github.com/ClickHouse/clickhouse-go/releases/tag/v2.30.1 |
Related issue with JSON strings: ClickHouse/ClickHouse#75832 Strings work now, but they don't preserve the same settings, example { "x": 42 } But the server will send back { "x": "42" } If you try to change { "x": 42 } Temporary fix is to cast |
Scope:
Object('json')
from @SpencerTorres preliminary research
What works:
string
JSON
when it is first cast to a string (::String
). Must be scanned into a Gostring
type.Dynamic
column (from within aJSON
object) when it is first cast to a string (::String
). Must be scanned into a Gostring
type.What doesn't work:
json.RawMessage
([]byte
) does not work (although I don't believe this works forString
either)JSON
type column, the Go driver reports it as an unsupported typeDynamic
type column, the Go driver reports it as an unsupported typeSample SQL:
Sample code:
Example of selecting an object key in Grafana (which uses our latest Go driver):

The text was updated successfully, but these errors were encountered: