Skip to content

Commit

Permalink
Querying scrape data: add additional helper views
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Nov 1, 2024
1 parent cab25df commit f468195
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion docs/data/query-scraper-output-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ FROM vote_events;
CREATE VIEW events AS
SELECT *
FROM read_json('event*.json');
CREATE VIEW event_documents AS
SELECT name AS event_name, _id AS event_id, unnest(documents, recursive := true)
FROM events;
CREATE VIEW event_document_links AS
SELECT event_name, event_id, note AS document_note, unnest(links, recursive := true)
FROM event_documents;
CREATE VIEW event_media AS
SELECT name AS event_name, _id AS event_id, unnest(media)
FROM events;
Expand Down Expand Up @@ -218,7 +224,7 @@ GROUP BY 1;
#### Vote Events over time (by month)

```sql
SELECT date_trunc('month', start_date), COUNT(*)
SELECT date_trunc('month', start_date::timestamp), COUNT(*)
FROM vote_events
GROUP BY 1,
ORDER BY 1;
Expand Down

0 comments on commit f468195

Please sign in to comment.