Access and analyze 537+ open datasets from the City of Toronto via the CKAN API. Data covers transit, traffic, housing, environment, budget, community services, and more.
Portal: https://open.toronto.ca Platform: CKAN API: https://ckan0.cf.opendata.inter.prod-toronto.ca
bash
# Search for datasets
python3 scripts/toronto_data.py search "traffic"
# List all datasets
python3 scripts/toronto_data.py list
# View dataset info
python3 scripts/toronto_data.py info 311-service-request-codes
# Fetch data from CKAN datastore
python3 scripts/toronto_data.py fetch traffic-volumes-at-intersections-for-all-modes --limit 5
# Fetch with filters
python3 scripts/toronto_data.py fetch traffic-volumes-at-intersections-for-all-modes --where "total_vehicle > 20000" --limit 10
# Export as CSV
python3 scripts/toronto_data.py fetch traffic-volumes-at-intersections-for-all-modes --limit 100 --csv > traffic.csv
# List datastore-enabled datasets
python3 scripts/toronto_data.py searchable
CommandDescriptionsearch <query>Search datasets by keywordlistList all datasetsinfo <dataset-id>Show dataset metadata and resourcesfetch <dataset-id>Fetch data from datastore (opts: --limit, --where, --select, --csv)searchableList datasets with queryable datastore resources
--limit N — Max rows to return (default: 10)--where "condition" — SQL filter (e.g., "total_vehicle > 20000")--select "col1,col2" — Choose specific columns--csv — Output as CSV instead of JSON--resource-id ID — Specify which resource to queryDataset IDs are URL-safe slugs (e.g., traffic-volumes-at-intersections-for-all-modes). Find them via search or list, or from the dataset URL: open.toronto.ca/dataset/{id}.
All data is sourced from the City of Toronto's Open Data Portal (open.toronto.ca). See references/datasets.md for a curated list of popular datasets.