Page MenuHomePhabricator

schema.cql

Authored By
Eevans
Nov 1 2021, 7:12 PM
Size
6 KB
Referenced Files
None
Subscribers
None

schema.cql

CREATE KEYSPACE image_recommendations WITH replication = {...};
-- Stores the metadata associated with an image recommendation.
CREATE TYPE image_recommendations.metadata (
confidence_rating float,
source text,
found_on set<text>,
);
-- The full data set; Recommendations for unillustrated articles.
CREATE TABLE image_recommendations.articles (
wiki text,
page_id int,
dataset_id timeuuid,
recommended_images map<text, frozen<metadata>>,
PRIMARY KEY((wiki, page_id))
);
-- An index of entries from the articles table above. Only page IDs with a non-zero
-- number of recommendations are included. Entries are keyed by an integer (idx)
-- that can be used to "number" results for pseudorandom selection (rand(0-length)).
CREATE TABLE image_recommendations.candidates (
wiki text,
dataset_id timeuuid,
idx int,
page_id int,
PRIMARY KEY((wiki, dataset_id), idx)
);
-- A candidates count (could be replaced with a SELECT count() FROM candidates)
CREATE TABLE image_recommendations.candidate_count (
wiki text,
dataset_id timeuuid,
count int,
PRIMARY KEY((wiki, dataset_id))
);

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9226055
Default Alt Text
schema.cql (6 KB)

Event Timeline