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

JSON data insertion doesn't seem to work #84

Closed
pavanagrawal123 opened this issue Dec 5, 2022 · 3 comments · Fixed by #85
Closed

JSON data insertion doesn't seem to work #84

pavanagrawal123 opened this issue Dec 5, 2022 · 3 comments · Fixed by #85
Labels
bug Something isn't working

Comments

@pavanagrawal123
Copy link

pavanagrawal123 commented Dec 5, 2022

Whenever passing in native JSON data, we get an exception:
Screen Shot 2022-12-04 at 7 54 04 PM

This occurs because, in the lower level write_native_data method, the v var is a string, which is being appended to a byte array.
image

I fixed this locally by encoding the v var into utf-8. Do I misunderstand something in the insertion process that I need to correct in the client-level code?

If it helps to debug, the JSON library chosen by clickhouse-connect is ujson.

@genzgd
Copy link
Collaborator

genzgd commented Dec 5, 2022

Yes, this is a bug specifically with ujson. orjson dumps returns bytes while ujson dumps returns a string, which I didn't catch in testing.

@genzgd genzgd added the bug Something isn't working label Dec 5, 2022
@genzgd genzgd linked a pull request Dec 5, 2022 that will close this issue
@genzgd genzgd closed this as completed in #85 Dec 5, 2022
@pavanagrawal123
Copy link
Author

Thanks so much, @genzgd , really appreciate the prompt reply and fix!

@genzgd
Copy link
Collaborator

genzgd commented Dec 5, 2022

Thanks for the detailed debugging information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants