Skip to content
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

Please support JSON / Object('json') type - at least [bulk] inserts #308

Open
v-instrumentix opened this issue May 23, 2023 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@v-instrumentix
Copy link

Dear all,
my app (c++) needs to populate JSON column.
Is there a plan to add support for it?

I made attempt to add JSON following implementation for String type (https://github.com/v-instrumentix/clickhouse-cpp.git - sorry if you find it nasty), but ended with server error

DB::Exception: Syntax error (data type): failed at position 1 ('{'): {"a":false, "b":true, "c":0, "d":1, "e":"Hello", "d":"", "z":null}. Expected one of: data type, nested table, identifier.

..that looks as I miss something about the protocol / encoding, and this is where I stuck.
Any hints would be welcome.

Thanks!

@Enmk
Copy link
Collaborator

Enmk commented Jun 5, 2023

Hi @v-instrumentix ! Well, there were no plans to support Json type, but any contribution is more than welcome. Please do not forget to update tests as well (I haven't found any in your repo)

@v-instrumentix
Copy link
Author

v-instrumentix commented Jun 5, 2023

Dear @Enmk , thanks for returning back to me.
I would be happy to contribute, but I miss knowledge of client-server protocol and encoding, so I failed with adding support for JSON in my previous attempt.
If you could point me to appropriate docs, I'll give it another try.
Cheers!

@Enmk
Copy link
Collaborator

Enmk commented Jun 7, 2023

There are not much docs on native client-server protocol, you'd have to read source of ClickHouse in order to understand how the data is transferred:

@v-val
Copy link

v-val commented Jun 7, 2023

@Enmk right, I tried to follow the code and made some progress this way but then stuck with the error above; hoped there're some docs that might help.

FYI, I was able to sort the functional side of problem via plain text bulk insert statements:

INSERT INTO `table` FORMAT TabSeparated
...

Thanks a lot for the hints anyway, I'll use them if / when I have a chance to proceed with this.

@Enmk Enmk added the enhancement New feature or request label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants