Some JSON datasets have mixed types of values of the same key in different records. Consider for example these two records: [{"a_key": "a text value"},{"a_key": ["text one", "text two"]}]. This scenario was not handled well by docdb_query.src_sqlite so far.
Description
The edits concern how the SQL statement is built and in particular, how SQLite's JSON1's functions are used to extract objects. Depending on the type of the value, the object is wrapped into an json_array call. This was added for mixed-type-values to the existing escaping and extracting code. At this occasion, I noticed that docdb_create.src_sqlite() was not robust for data where the json string does not include an _id. The method now is robust after changing to a simpler list handling.
Some JSON datasets have mixed types of values of the same key in different records. Consider for example these two records:
[{"a_key": "a text value"},{"a_key": ["text one", "text two"]}]
. This scenario was not handled well bydocdb_query.src_sqlite
so far.Description
The edits concern how the SQL statement is built and in particular, how SQLite's JSON1's functions are used to extract objects. Depending on the type of the value, the object is wrapped into an
json_array
call. This was added for mixed-type-values to the existing escaping and extracting code. At this occasion, I noticed thatdocdb_create.src_sqlite()
was not robust for data where the json string does not include an _id. The method now is robust after changing to a simpler list handling.Example