mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
New ?tags__arraycontains=tag lookup against JSON fields
Part one of supporting facet-by-JSON-array, refs #359
This commit is contained in:
parent
3a208a41d4
commit
78e45ead4d
6 changed files with 74 additions and 41 deletions
|
|
@ -523,26 +523,27 @@ CREATE TABLE facetable (
|
|||
state text,
|
||||
city_id integer,
|
||||
neighborhood text,
|
||||
tags text,
|
||||
FOREIGN KEY ("city_id") REFERENCES [facet_cities](id)
|
||||
);
|
||||
INSERT INTO facetable
|
||||
(planet_int, on_earth, state, city_id, neighborhood)
|
||||
(planet_int, on_earth, state, city_id, neighborhood, tags)
|
||||
VALUES
|
||||
(1, 1, 'CA', 1, 'Mission'),
|
||||
(1, 1, 'CA', 1, 'Dogpatch'),
|
||||
(1, 1, 'CA', 1, 'SOMA'),
|
||||
(1, 1, 'CA', 1, 'Tenderloin'),
|
||||
(1, 1, 'CA', 1, 'Bernal Heights'),
|
||||
(1, 1, 'CA', 1, 'Hayes Valley'),
|
||||
(1, 1, 'CA', 2, 'Hollywood'),
|
||||
(1, 1, 'CA', 2, 'Downtown'),
|
||||
(1, 1, 'CA', 2, 'Los Feliz'),
|
||||
(1, 1, 'CA', 2, 'Koreatown'),
|
||||
(1, 1, 'MI', 3, 'Downtown'),
|
||||
(1, 1, 'MI', 3, 'Greektown'),
|
||||
(1, 1, 'MI', 3, 'Corktown'),
|
||||
(1, 1, 'MI', 3, 'Mexicantown'),
|
||||
(2, 0, 'MC', 4, 'Arcadia Planitia')
|
||||
(1, 1, 'CA', 1, 'Mission', '["tag1", "tag2"]'),
|
||||
(1, 1, 'CA', 1, 'Dogpatch', '["tag1", "tag3"]'),
|
||||
(1, 1, 'CA', 1, 'SOMA', '[]'),
|
||||
(1, 1, 'CA', 1, 'Tenderloin', '[]'),
|
||||
(1, 1, 'CA', 1, 'Bernal Heights', '[]'),
|
||||
(1, 1, 'CA', 1, 'Hayes Valley', '[]'),
|
||||
(1, 1, 'CA', 2, 'Hollywood', '[]'),
|
||||
(1, 1, 'CA', 2, 'Downtown', '[]'),
|
||||
(1, 1, 'CA', 2, 'Los Feliz', '[]'),
|
||||
(1, 1, 'CA', 2, 'Koreatown', '[]'),
|
||||
(1, 1, 'MI', 3, 'Downtown', '[]'),
|
||||
(1, 1, 'MI', 3, 'Greektown', '[]'),
|
||||
(1, 1, 'MI', 3, 'Corktown', '[]'),
|
||||
(1, 1, 'MI', 3, 'Mexicantown', '[]'),
|
||||
(2, 0, 'MC', 4, 'Arcadia Planitia', '[]')
|
||||
;
|
||||
|
||||
INSERT INTO simple_primary_key VALUES (1, 'hello');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue