Skip to content

Commit

Permalink
DuckDB: add views for Events
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Oct 18, 2024
1 parent 431b513 commit 2ab8e92
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/data/query-scraper-output-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,26 @@ SELECT legislative_session,
_id AS vote_id,
unnest(counts, recursive := true)
FROM vote_events;

-- Events
CREATE VIEW events AS
SELECT *
FROM read_json('event*.json');
CREATE VIEW event_media AS
SELECT name AS event_name, _id AS event_id, unnest(media)
FROM events;
CREATE VIEW event_participants AS
SELECT name AS event_name, _id AS event_id, unnest(participants, recursive := true)
FROM events;
CREATE VIEW event_agenda AS
SELECT name AS event_name, _id AS event_id, unnest(agenda, recursive := true)
FROM events;
CREATE VIEW event_agenda_related_entities AS
SELECT event_name, event_id, unnest(related_entities, recursive := true)
FROM event_agenda;
CREATE VIEW event_sources AS
SELECT name AS event_name, _id AS event_id, unnest(sources, recursive := true)
FROM events;
```

To view Views in your DuckDB database: `SHOW TABLES;`
Expand Down

0 comments on commit 2ab8e92

Please sign in to comment.