-
Notifications
You must be signed in to change notification settings - Fork 68
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
Querybuilder suggestions for json field (nested json attributes) #542
Comments
From my understanding, the JSON column type doesn't always have a consistent schema. For the current suggestions the plugin will sample the table's schema, but in this case we would have to sample rows and determine which fields are on a JSON payload. The JSON's schema could change between rows too. I think for now a good workaround is to write the column in manually if you know your schema. Any thoughts @aangelisc ? |
Yeah this is a nuanced topic that can be quite complicated to resolve. The following question if we were to sample rows would then be how to handle nested JSON or, as @SpencerTorres mentioned, columns where the JSON is inconsistent between rows. The |
Look at example. CREATE TABLE test.logs2
If we have in first row JSON {"row": 1}, after we add new row with JSON {"second_field": "new field"}, clickhouse server adds field "second_field" for the first row with empty string value. |
I appreciate the test queries you ran there, I see how that could solve the row inconsistency problem. This brings up some more questions though:
|
I find it difficult to answer about unique set of keys for the entire table. ORDER BY tuple() syntax create a table with no primary key. In this case, Clickhouse stores data in insert order.
and limit 1 for example above return only same first row:
2.2) Zero as number empty |
Thanks for sharing the example queries, I didn't know the JSON type had this behavior! |
After revisiting this thread, I don't think this is something we will add based on how the plugin functions now. The JSON column type is experimental and obsolete, but I will keep this concept in mind for Map types if we ever expand on query suggestions. |
Hello, colleagues.
Querybuilder web interface doesn't suggest some options for nested JSON attributes in JSON field.
I have a 2 column table
When write sql query in querybuilder it show timestamp and message field for me, but it don't know something about nested json attributes.
In example below you can see, that query return successful result for message.status, but querybuilder doesn't suggest some nested JSON attributes from message field for selection.
The text was updated successfully, but these errors were encountered: