Query the Data Delivery Network
Query the DDNThe 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 edmontonians_perception_survey_connectedness
table in this repository, by referencing it like:
"edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest"."edmontonians_perception_survey_connectedness"
or in a full query, like:
SELECT
":id", -- Socrata column ID
"qd7_do_you_work_for_the_city_of_edmonton", -- Profiling question. Question: Do you work for the City of Edmonton? || Possible Answers: Yes|No
"d1a_as_different_people_may_have_different_views_and_needs_the_", -- Question: As different people may have different views and needs, including yourself, how many people are there in your household?
"qd_how_long_have_you_lived_in_edmonton", -- Profiling question. Question: How long have you lived in Edmonton? || Possible Answers: Less than 6 months|6 months to less than 1 year|1 year to less than 3 years|3 years to less than 5 years|5 years or more
"q10bm5_why_do_you_say_that", -- Question: Why do you say that? (Can select up to 5) || Possible Answers: I was born in this city / I live in this city|It is a good city / I like this city / It is a beautiful city|The city is very clean/well maintained|Wide variety of attractions / Many things to do in the city|Low unemployment / Good economy|Good parks / I like the river valley and trail system|Good sports/recreation facilities|My friends live in this city / Friendly people live in the city|Good accessibility within the city (no traffic, good public transit, well planned streets etc.)|It is a culturally rich city|High standard of living|Low/good cost of living / Low taxes|It is a good city for families / It is a good city to raise children|Good climate/weather|Good municipal government|It is a safe city to live in / Low crime rate|Good education system|Good infrastructure|Good healthcare system|The size of the city|Good services (unspecified)|*** I am well connected to the community|*** I am informed about attractions / events|It is an expensive city / High cost of living / High taxes|It is a culturally poor city|The roads are in poor condition / Infrastructure is in poor condition|There is a lot of traffic|I do not like the weather/climate in this city|High crime rate / I do not feel the city is safe|Poor public transit|Poor education system|Poor community involvement / Citizens do not actively participate in the community|Fewer festivals and events when compared to other major Canadian cities|Poor economy / low level of employment|High cost of housing / Lack of affordable housing|Poor municipal government / I do not like the decisions made by the current municipal government|Poor healthcare system|Poor snow removal services|A lot of construction is being conducted within the city|The city is not clean / The city is not properly maintained|More recreation facilties are required|Poor city services|Always room for improvement|*** I am not well connected to the community|*** I recently moved to the city|*** I am too busy to get involved|*** Not enough adverstising regarding attractions / events|Enter verbatims|None / I have no specified reason to feel this way|I don't know / Refusal
"q10bm4_why_do_you_say_that", -- Question: Why do you say that? (Can select up to 5) || Possible Answers: I was born in this city / I live in this city|It is a good city / I like this city / It is a beautiful city|The city is very clean/well maintained|Wide variety of attractions / Many things to do in the city|Low unemployment / Good economy|Good parks / I like the river valley and trail system|Good sports/recreation facilities|My friends live in this city / Friendly people live in the city|Good accessibility within the city (no traffic, good public transit, well planned streets etc.)|It is a culturally rich city|High standard of living|Low/good cost of living / Low taxes|It is a good city for families / It is a good city to raise children|Good climate/weather|Good municipal government|It is a safe city to live in / Low crime rate|Good education system|Good infrastructure|Good healthcare system|The size of the city|Good services (unspecified)|*** I am well connected to the community|*** I am informed about attractions / events|It is an expensive city / High cost of living / High taxes|It is a culturally poor city|The roads are in poor condition / Infrastructure is in poor condition|There is a lot of traffic|I do not like the weather/climate in this city|High crime rate / I do not feel the city is safe|Poor public transit|Poor education system|Poor community involvement / Citizens do not actively participate in the community|Fewer festivals and events when compared to other major Canadian cities|Poor economy / low level of employment|High cost of housing / Lack of affordable housing|Poor municipal government / I do not like the decisions made by the current municipal government|Poor healthcare system|Poor snow removal services|A lot of construction is being conducted within the city|The city is not clean / The city is not properly maintained|More recreation facilties are required|Poor city services|Always room for improvement|*** I am not well connected to the community|*** I recently moved to the city|*** I am too busy to get involved|*** Not enough adverstising regarding attractions / events|Enter verbatims|None / I have no specified reason to feel this way|I don't know / Refusal
"q10bm2_why_do_you_say_that", -- Question: Why do you say that? (Can select up to 5) || Possible Answers: I was born in this city / I live in this city|It is a good city / I like this city / It is a beautiful city|The city is very clean/well maintained|Wide variety of attractions / Many things to do in the city|Low unemployment / Good economy|Good parks / I like the river valley and trail system|Good sports/recreation facilities|My friends live in this city / Friendly people live in the city|Good accessibility within the city (no traffic, good public transit, well planned streets etc.)|It is a culturally rich city|High standard of living|Low/good cost of living / Low taxes|It is a good city for families / It is a good city to raise children|Good climate/weather|Good municipal government|It is a safe city to live in / Low crime rate|Good education system|Good infrastructure|Good healthcare system|The size of the city|Good services (unspecified)|*** I am well connected to the community|*** I am informed about attractions / events|It is an expensive city / High cost of living / High taxes|It is a culturally poor city|The roads are in poor condition / Infrastructure is in poor condition|There is a lot of traffic|I do not like the weather/climate in this city|High crime rate / I do not feel the city is safe|Poor public transit|Poor education system|Poor community involvement / Citizens do not actively participate in the community|Fewer festivals and events when compared to other major Canadian cities|Poor economy / low level of employment|High cost of housing / Lack of affordable housing|Poor municipal government / I do not like the decisions made by the current municipal government|Poor healthcare system|Poor snow removal services|A lot of construction is being conducted within the city|The city is not clean / The city is not properly maintained|More recreation facilties are required|Poor city services|Always room for improvement|*** I am not well connected to the community|*** I recently moved to the city|*** I am too busy to get involved|*** Not enough adverstising regarding attractions / events|Enter verbatims|None / I have no specified reason to feel this way|I don't know / Refusal
"calldurationinseconds", -- Duration of the call in seconds
"completion_date", -- Date the respondent did the survey
"qd6_what_is_the_primary_language_spoken_in_your_household", -- Profiling question. Question: What is the primary language spoken in your household? || Possible Answers: English|French|Others
"d7_which_of_the_following_best_describes_your_marital_status_ar", -- Profiling question. Question: Which of the following best describes your marital status? Are you... || Possible Answers: Single, never married|Married or common law|Separated, divorced, widowed|Don't know/Prefer not to answer
"d2c_between_18_and_65_years_of_age", -- Question: How many people in your household are: Between 18 and 65 years of age
"qe_fsa", -- Forward Sortation Area (first 3 characters of postal code)
"d3_age", -- Profiling question. Question: Your age? || Possible Answers: Under 18 years old|18 - 24|25 - 34|35 - 44|45 - 54|55 - 64|65 years and over|Refused
"q11g_how_much_do_you_agree_or_disagree_there_are_regular_commun", -- Question: How much do you agree or disagree. - There are regular community events in your community || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"qd11_were_you", -- Profiling question. Question: Were you? || Possible Answers: Born in Canada|Moved to Canada from somewhere else
"qd10_and_what_type_of_residence_do_you_live_in", -- Profiling question. Question: What type of residence do you live in? || Possible Answers: House|Duplex|Four-plex|Apartment|Condo|Townhouse|Other
"qd9_do_you_currently_own_or_rent_your_place_of_residence", -- Profiling question. Question: Do you currently own or rent your place of residence? || Possible Answers: Own|Rent
"qd8_did_you_vote_in_the_most_recent_municipal_election_for_the_", -- Profiling question. Question: Did you vote in the most recent municipal election for the City of Edmonton? || Possible Answers: Yes|No|I was not eligible
"qd5b_which_of_the_following_best_describes_your_total_personal_", -- Profiling question. Question: Which of the following best describes your total personal annual income before taxes? || Possible Answers: Less than $20,000|Between $20,000 and $29,999|Between $30,000 and $49,999|Between $50,000 and $79,999|Between $80,000 and $119,999|$120,000 or more|Prefer not to answer
"qd4_are_you_currently", -- Profiling question. Question: Which of the following best describes your employment status, are you currently... || Possible Answers: Working full time|Working part time|A student|Not working outside the home|Retired|Prefer not to answer
"qd3_what_is_the_highest_level_of_education_you_have_achieved", -- Profiling question. Question: What is the highest level of education you have achieved?? || Possible Answers: Less than high school|Graduated high school|Graduated college, technical or vocational school|Graduated university|Prefer not to answer
"d2tot_total_children_in_hh", -- Question: Total number of children in your household?
"d2d_over_65_years_of_age", -- Question: How many people in your household are: Over 65 years of age
"d2b_between_10_and_17_years_of_age", -- Question: How many people in your household are: Between 10 and 17 years of age
"d2a_under_10_years_of_age", -- Question: How many people in your household are: Under 10 years of age
"qdr_city_quadrant", -- Profiling question. Question: City Quadrant? || Possible Answers: NW|NE|SE|SW|Other
"d1_gender", -- Profiling question. Question: Your gender? || Possible Answers: Female|Male
"q11h_how_much_do_you_agree_or_disagree_you_can_get_help_from_fa", -- Question: How much do you agree or disagree. - You can get help from family & friends when needed || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11f_how_much_do_you_agree_or_disagree_you_know_your_neighbours", -- Question: How much do you agree or disagree. - You know your neighbours || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11e_how_much_do_you_agree_or_disagree_your_friends_or_family_a", -- Question: How much do you agree or disagree. - Your friends or family also live in the same community || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11d_how_much_do_you_agree_or_disagree_you_have_access_to_commu", -- Question: How much do you agree or disagree. - You have access to community events || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11c_how_much_do_you_agree_or_disagree_you_have_access_to_commu", -- Question: How much do you agree or disagree. - You have access to community facilities such as parks, libraries, etc. || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11b_how_much_do_you_agree_or_disagree_you_are_active_and_invol", -- Question: How much do you agree or disagree. - You are active and involved in your community || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q11a_how_much_do_you_agree_or_disagree_your_community_is_friend", -- Question: How much do you agree or disagree. - Your community is friendly and supportive || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"q10bm3_why_do_you_say_that", -- Question: Why do you say that? (Can select up to 5) || Possible Answers: I was born in this city / I live in this city|It is a good city / I like this city / It is a beautiful city|The city is very clean/well maintained|Wide variety of attractions / Many things to do in the city|Low unemployment / Good economy|Good parks / I like the river valley and trail system|Good sports/recreation facilities|My friends live in this city / Friendly people live in the city|Good accessibility within the city (no traffic, good public transit, well planned streets etc.)|It is a culturally rich city|High standard of living|Low/good cost of living / Low taxes|It is a good city for families / It is a good city to raise children|Good climate/weather|Good municipal government|It is a safe city to live in / Low crime rate|Good education system|Good infrastructure|Good healthcare system|The size of the city|Good services (unspecified)|*** I am well connected to the community|*** I am informed about attractions / events|It is an expensive city / High cost of living / High taxes|It is a culturally poor city|The roads are in poor condition / Infrastructure is in poor condition|There is a lot of traffic|I do not like the weather/climate in this city|High crime rate / I do not feel the city is safe|Poor public transit|Poor education system|Poor community involvement / Citizens do not actively participate in the community|Fewer festivals and events when compared to other major Canadian cities|Poor economy / low level of employment|High cost of housing / Lack of affordable housing|Poor municipal government / I do not like the decisions made by the current municipal government|Poor healthcare system|Poor snow removal services|A lot of construction is being conducted within the city|The city is not clean / The city is not properly maintained|More recreation facilties are required|Poor city services|Always room for improvement|*** I am not well connected to the community|*** I recently moved to the city|*** I am too busy to get involved|*** Not enough adverstising regarding attractions / events|Enter verbatims|None / I have no specified reason to feel this way|I don't know / Refusal
"q10bm1_why_do_you_say_that", -- Question: Why do you say that? (Can select up to 5) || Possible Answers: I was born in this city / I live in this city|It is a good city / I like this city / It is a beautiful city|The city is very clean/well maintained|Wide variety of attractions / Many things to do in the city|Low unemployment / Good economy|Good parks / I like the river valley and trail system|Good sports/recreation facilities|My friends live in this city / Friendly people live in the city|Good accessibility within the city (no traffic, good public transit, well planned streets etc.)|It is a culturally rich city|High standard of living|Low/good cost of living / Low taxes|It is a good city for families / It is a good city to raise children|Good climate/weather|Good municipal government|It is a safe city to live in / Low crime rate|Good education system|Good infrastructure|Good healthcare system|The size of the city|Good services (unspecified)|*** I am well connected to the community|*** I am informed about attractions / events|It is an expensive city / High cost of living / High taxes|It is a culturally poor city|The roads are in poor condition / Infrastructure is in poor condition|There is a lot of traffic|I do not like the weather/climate in this city|High crime rate / I do not feel the city is safe|Poor public transit|Poor education system|Poor community involvement / Citizens do not actively participate in the community|Fewer festivals and events when compared to other major Canadian cities|Poor economy / low level of employment|High cost of housing / Lack of affordable housing|Poor municipal government / I do not like the decisions made by the current municipal government|Poor healthcare system|Poor snow removal services|A lot of construction is being conducted within the city|The city is not clean / The city is not properly maintained|More recreation facilties are required|Poor city services|Always room for improvement|*** I am not well connected to the community|*** I recently moved to the city|*** I am too busy to get involved|*** Not enough adverstising regarding attractions / events|Enter verbatims|None / I have no specified reason to feel this way|I don't know / Refusal
"q10a_considering_all_aspects_of_your_community_life_please_indi", -- Question: Considering all aspects of your community life, please indicate the degree to which you agree or disagree with the following statement. - I feel connected to my community || Possible Answers: 5 - Strongly Agree|4 - Agree|3 - Neither agree or disagree|2 - Disagree|1 - Strongly Disagree|Don't know
"qd5a_which_of_the_following_best_describes_your_total_annual_ho" -- Profiling question. Question: Which of the following best describes your total annual household income before taxes? || Possible Answers: Less than $20,000|Between $20,000 and $29,999|Between $30,000 and $49,999|Between $50,000 and $79,999|Between $80,000 and $119,999|$120,000 or more|Prefer not to answer
FROM
"edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest"."edmontonians_perception_survey_connectedness"
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/edmontonians-perception-survey-connectedness-i2x2-wadk
with SQL in under 60 seconds.
Query Your Local Engine
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; sgr
can manage the image, container and volume for you.
There are a few ways to ingest data into the local engine.
For external repositories, 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 (like this repository), where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr clone
and sgr checkout
.
Cloning Data
Because edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest
is a Splitgraph Image, you can clone the data from Spltgraph Cloud to your local engine, where you can query it like any other Postgres database, using any of your existing tools.
First, install Splitgraph if you haven't already.
Clone the metadata with sgr clone
This will be quick, and does not download the actual data.
sgr clone edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk
Checkout the data
Once you've cloned the data, you need to "checkout" the tag that you want. For example, to checkout the latest
tag:
sgr checkout edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest
This will download all the objects for the latest
tag of edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk
and load them into the Splitgraph Engine. Depending on your connection speed and the size of the data, you will need to wait for the checkout to complete. Once it's complete, you will be able to query the data like you would any other Postgres database.
Alternatively, use "layered checkout" to avoid downloading all the data
The data in edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest
is 0 bytes. If this is too big to download all at once, or perhaps you only need to query a subset of it, you can use a layered checkout.:
sgr checkout --layered edmonton-ca/edmontonians-perception-survey-connectedness-i2x2-wadk:latest
This will not download all the data, but it will create a schema comprised of foreign tables, that you can query as you would any other data. Splitgraph will lazily download the required objects as you query the data. In some cases, this might be faster or more efficient than a regular checkout.
Read the layered querying documentation to learn about when and why you might want to use layered queries.
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/edmontonians-perception-survey-connectedness-i2x2-wadk
is just another Postgres schema.