edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp
Icon for Socrata external plugin

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the bylaws_march_2015_edmonton_insight_community table in this repository, by referencing it like:

"edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp:latest"."bylaws_march_2015_edmonton_insight_community"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "age_rollup_detailed_study_profiling_questionnaire_2014", --  Profiling question, Based on birthdate entered by Respondent. System Determined. Question: Age Rollup? -  || Possible Answers: Under 15/15-17/18-24/25-29/30-34/35-39/40-44/45-49/50-54/55-59/60-64/65-69/70-74/75-79/80 and over 
    "fsa_study_profiling_questionnaire_2014", --  Forward Sortation Area (first 3 characters of postal code) 
    "q14a_primary_transportation_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - What is your primary mode of transportation? || Possible Answers: Car/truck/Van as DRIVER/Car/truck/van as PASSENGER/Public Transit/Walk/Bicycle/Other (Specify) 
    "cs_community_experiences_abandoned_vehicles", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Abandoned vehicles || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_messy_or_problem_properties_weeds_fenc", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Messy or problem properties (weeds, fences, smelly compost, smoke from fire pits, garbage storage, construction materials, couches, appliances, auto parts etc.) || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_presence_of_pet_feces_on_public_proper", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Presence of pet feces on public property (neighborhood parks etc.) || Possible Answers: Yes (1)/No (0) 
    "responsedate", -- Date/Time the respondent first opened/started the survey.
    "q12_employment_status_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - What is your current employment status? || Possible Answers: Employed full-time (30+ hours a week)/Employed part-time (0-30 hours a week)/Homemaker/Post-secondary student/High School Student/Unemployed/Permanently unable to Work/Retired/Other (Specify) 
    "responsible_bylaw_eps_response_and_follow_up_to_complaints_of_m", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response and follow-up to complaints of messy or problem properties (weeds, fences, smelly compost, smoke from fire pits, garbage storage, construction material || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "q15_household_income_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Which of the following categories best describes your total household income in 2014 before taxes? || Possible Answers: Under $20,000/$20,000 to $29,999/$30,000 to $39,999/$40,000 to $49,999/$50,000 to $59,999/$60,000 to $79,999/$80,000 to $99,999/$100,000 to $149,000/$150,000 and over/Prefer not to answer 
    "q14b_secondary_transportation_study_profiling_questionnaire_201", --  Profiling question, one response selected by respondent. - What is your secondary mode of transportation? || Possible Answers: Car/truck/Van as DRIVER/Car/truck/van as PASSENGER/Public Transit/Walk/Bicycle/Only have one mode of transportation/Other (Specify) 
    "q9a_edmonton_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - How long have you lived in Edmonton? || Possible Answers: Less than 1 year/Between 1 to 2 years/Between 3 to 5 years/Greater than 5 years/I do not live in Edmonton 
    "q8_born_canada_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Were you born in Canada? || Possible Answers: Yes/No 
    "responsible_bylaw_eps_response_to_reported_graffiti_on_public_p", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response to reported graffiti on public property || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "cs_community_experiences_snow_removal_on_residential_sidewalks", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Snow removal on residential sidewalks || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_noxious_weeds_problem_weeds_and_plants", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Noxious weeds (problem weeds and plants that disrupt or destroy the natural ecosystem) on public property (parks, fields) || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_graffiti_on_private_property_houses_ga", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Graffiti on private property (houses, garages, fences) || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_unoccupied_and_or_run_down_houses_or_b", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Unoccupied and/or run-down houses or buildings || Possible Answers: Yes (1)/No (0) 
    "completiondate", -- Date/Time the respondent finished the survey.
    "cs_community_experiences_presence_of_pet_feces_on_private_prope", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Presence of pet feces on private property. || Possible Answers: Yes (1)/No (0) 
    "devicetype", --  System Captured, Device used by the respondent. Question: Device Type? - DeviceType || Possible Answers: Tablet/Desktop/Phone 
    "cs_community_experiences_haven_t_experience_any_of_these", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Haven’t experience any of these || Possible Answers: Yes (1)/No (0) 
    "responsible_bylaw_eps_ticketing_towing_of_vehicles_parked_i_000", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Ticketing/towing of vehicles parked illegally on snow routes during snow ban || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "responsible_bylaw_eps_response_to_reported_graffiti_on_private_", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response to reported graffiti on private property || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "responsible_bylaw_eps_response_to_or_trapping_of_stray_cats_or_", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response to or trapping of stray cats or dogs || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "responsible_bylaw_eps_fines_for_littering", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Fines for littering || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "responsible_bylaw_eps_response_to_residential_noise_complaints", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response to residential noise complaints || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "cs_community_experiences_illegal_parking_on_snow_routes_during_", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Illegal parking on snow routes during parking bans || Possible Answers: Yes (1)/No (0) 
    "q7_children_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Do you have children 18 or under living at home? || Possible Answers: Yes/No 
    "responsible_bylaw_eps_ticketing_towing_of_vehicles_parked_i_001", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Ticketing/towing of vehicles parked illegally on streets and thoroughfares during peak commute times || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "cs_community_experiences_other", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Other: || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_excessive_noise", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Excessive noise || Possible Answers: Yes (1)/No (0) 
    "responsible_bylaw_eps_response_to_reported_illegal_dumping", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Response to reported illegal dumping || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "responsible_bylaw_eps_ticketing_towing_of_abandoned_vehicles", --  Respondents were asked to drag each complaint to EPS or Bylaw officer. Question: Who do you think is responsible for  - Ticketing/towing of abandoned vehicles || Possible Answers: Edmonton Police Service/Edmonton Bylaw Officers 
    "q10_own_business_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Do you own a business in the City of Edmonton? || Possible Answers: Yes/No 
    "q11_home_language_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - What is the primary language spoken in your household? || Possible Answers: English/Arabic/Cantonese/Spanish/Panjabi (Punjabi)/French/German/Mandarin/Tagalog (Pilipino, Filipino)/Ukrainian/Other (Specify) 
    "q3_own_rent_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Do you own or rent your primary residence in the City of Edmonton? || Possible Answers: Own/Rent 
    "gender_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Are you…? || Possible Answers: Male/Female/Other/I prefer not to answer 
    "ostype", --  System Captured, OS used by the respondent. Question: OS Type? - OSType || Possible Answers: Mac (OS X)/Linux/Windows/iOS/Android/BlackBerry/Unknown 
    "browsertype", --  System Captured, Browser used by the respondent. Question: Browser Type? - BrowserType || Possible Answers: Internet Explorer/Firefox/Safari/Google Chrome/Opera/Android/BlackBerry/Unknown 
    "cs_community_experiences_presence_of_wildlife_coyotes_deer_etc", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Presence of wildlife (coyotes, deer etc.) || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_illegal_dumping", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Illegal dumping || Possible Answers: Yes (1)/No (0) 
    "cs_community_experiences_stray_animals", --  Respondents were asked to select all that apply. Question: Based on your personal observations, do you find that your community experiences any of the following issues on a reoccurring basis:-Stray animals || Possible Answers: Yes (1)/No (0) 
    "q9b_live_before_edmonton_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Where did you previously reside before you moved to Edmonton? || Possible Answers: Elsewhere in Alberta/Atlantic Canada/Ontario/Quebec/Territories/Manitoba/Saskatchewan/British Columbia/Outside of Canada 
    "q13_volunteer_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - In the last 12 months, did you do any activities without pay on behalf of a group or an organization as a volunteer? || Possible Answers: Yes/No 
    "q17_city_employee_study_profiling_questionnaire_2014", --  Profiling question, one response selected by respondent. - Do you work for the City of Edmonton? || Possible Answers: Yes/No 
    "q16_education_study_profiling_questionnaire_2014" --  Profiling question, one response selected by respondent. - What is the highest level of education you have completed? || Possible Answers: Elementary/grade school graduate/High school graduate/College / technical school graduate/University undergraduate degree/Post-graduate degree/Professional school graduate (e.g. medicine, dentistry, veterinary medicine, optometry) 
FROM
    "edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp:latest"."bylaws_march_2015_edmonton_insight_community"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.edmonton.ca. When you queryedmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories (like this repository), the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.edmonton.ca, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp" \
  --handler-options '{
    "domain": "data.edmonton.ca",
    "tables": {
        "bylaws_march_2015_edmonton_insight_community": "hava-trgp"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph engine, you can query it with any of your existing tools. As far as they're concerned, edmonton-ca/bylaws-march-2015-edmonton-insight-community-hava-trgp is just another Postgres schema.