Compare two lists, one of them JSON, in SQLite - Stack Overflow
I am trying to implement tagging on objects, tracked through an SQLite database. My table looks something like this (simplified for example):
create table file (
path varchar not null,
frontmatter JSON default '' not null, --JSON
constraint page_pk
primary key (logicalPath, ext)
);
The JSON field is structured like (again, simplified):
{
"title": "Something",
"tags": ["a", "b", "c"]
}
I'm trying to figure out the best way to do "find all documents with at least one of these tags" and "find all documents with all of these tags."
So far, I've figured out how to do that if I skip JSON and materialize the tags out to a separate table. It's just kind of ugly. With JSON, the best I've figured out how to do is use a View or CTE (WITH statment) and json_each()
that produces that materialized table on the fly, which doesn't seem like much of a win.
I feel like there should be some way to intersect two list-fields, so I can do something like json_extract(frontmatter, '$.tags') IN (?, ?)
or some "all" equivalent, but I've not been able to find one and my search-fu has not yet found anyone else doing it. Can someone offer pointers to how I would do this?
- 三问凡客“毁三观”
- 手机防盗软件拍下“嫌疑人”可当呈堂证供
- reactjs - The difference between @Vite4 and @Vite5 - Stack Overflow
- Gmail SMTP relay with postfix - Stack Overflow
- Unable to create a azure synapse workspace? - Stack Overflow
- apache beam - Unable to Write processed Data to Parquet - Stack Overflow
- swift - DCoder bitwise solution. As I can't see the test cases, it's difficult to understand what I did wrong -
- express - What is the point of http-only cookies and how to make your authentication secure? - Stack Overflow
- android - Slow screen value detection using root access and uiautomator in Kotlin – Optimization help needed - Stack Overflow
- amazon web services - How to create a CloudWatch alarm for an EventBridge Pipe's stopped state in AWS? - Stack Overflow
- kotlin - Do I need Serialization to Transfer a MutableMap Between Minecraft Server and Client? If so, How Should I Serialize It?
- c++ - Microbenchmark - backward iteration results in fewer cache misses - Stack Overflow
- utf 8 - correct way to Import database dump in PowerShell - Stack Overflow
- ESP32 Bluetooth - Is it possible to keep Provisioning Manager Bluetooth Up, After Provisioning Is Done? - Stack Overflow
- Has Paho MQTT Client for Ionic on Android limitations regarding the number of client instances? - Stack Overflow
- php - Laravel Defer on API requests - Stack Overflow
- c# - Microsoft.Extensions.Logging.LoggerFactory how to prevent an extra date to be added to the log filename - Stack Overflow