Re: [sqlite] JSON1: queries on object keys

2019-03-28 Thread Wout Mertens
Hmmm right, valid points. The queries I'm doing are on slices of data that are preselected using indices, and then right now I'm post-filtering them in the application, and I was just wondering if I could already do better filtering on the db side before paying the serialization costs. In fact,

Re: [sqlite] JSON1: queries on object keys

2019-03-28 Thread Warren Young
On Mar 28, 2019, at 4:15 AM, Wout Mertens wrote: > > - I don't see how json_type can help I don’t see “json_type” in this thread at all, other than this message. > - Schemaless data is really nice to work with Sure, but it has a cost. Unless you’re willing to give us a *lot* more

Re: [sqlite] JSON1: queries on object keys

2019-03-28 Thread Wout Mertens
To answer all emails in this thread: - I don't see how json_type can help, I want to query the keys of objects - Schemaless data is really nice to work with, the wrapper I use does allow putting parts of the JSON object into real columns but changing the production db schema all the

Re: [sqlite] JSON1: queries on object keys

2019-03-26 Thread Jens Alfke
> On Mar 26, 2019, at 10:41 AM, Warren Young wrote: > > The biggest problem with these isn’t the use of JSON per se, it’s that each > one is unindexed, so they’ll all be a full table scan. Well, we don’t know that; the question was just about whether those are reasonable queries, not

Re: [sqlite] JSON1: queries on object keys

2019-03-26 Thread Warren Young
On Mar 26, 2019, at 8:35 AM, Wout Mertens wrote: > > what would be the best way to answer these, given `CREATE TABLE foo(id > TEXT, json JSON);` and json is always a json object: > > - all rows with a given key bar > - SELECT * FROM foo WHERE json_extract(json, '$.bar') IS NOT NULL; >

Re: [sqlite] JSON1: queries on object keys

2019-03-26 Thread Dominique Devienne
On Tue, Mar 26, 2019 at 3:35 PM Wout Mertens wrote: > Hi amazing list, > > what would be the best way to answer these, given `CREATE TABLE foo(id > TEXT, json JSON);` and json is always a json object: > >- all rows with a given key bar > - SELECT * FROM foo WHERE json_extract(json,

[sqlite] JSON1: queries on object keys

2019-03-26 Thread Wout Mertens
Hi amazing list, what would be the best way to answer these, given `CREATE TABLE foo(id TEXT, json JSON);` and json is always a json object: - all rows with a given key bar - SELECT * FROM foo WHERE json_extract(json, '$.bar') IS NOT NULL; - all rows where there are only any of the