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 assessor_parcel_universe table in this repository, by referencing it like:
"datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j:latest"."assessor_parcel_universe"or in a full query, like:
SELECT
    ":id", -- Socrata column ID
    "tax_park_district_name", -- Park district name
    "chicago_industrial_corridor_data_year", -- Chicago industrial corridor data year
    "chicago_police_district_num", -- Chicago police district number
    "chicago_police_district_data_year", -- Chicago police district data year
    "env_airport_noise_dnl", -- Airport continuous noise surface estimated DNL
    "env_flood_fema_sfha", -- FEMA Special Flood Hazard Area (SFHA) indicator
    "env_flood_fs_data_year", -- First Street data year
    "school_secondary_district_geoid", -- School district (secondary) GEOID, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "econ_coordinated_care_area_num", -- Coordinated Care Area number
    "econ_coordinated_care_area_data_year", -- Coordinated Care Area data year
    "econ_enterprise_zone_num", -- Enterprise Zone number
    "econ_enterprise_zone_data_year", -- Enterprise Zone data year
    "econ_industrial_growth_zone_num", -- Industrial Growth Zone number
    "econ_industrial_growth_zone_data_year", -- Industrial Growth Zone data year
    "econ_qualified_opportunity_zone_num", -- Qualified Opportunity Zone number
    "econ_qualified_opportunity_zone_data_year", -- Qualified Opportunity Zone data year
    "env_flood_fs_factor", -- First Street Flood Factor
    "env_ohare_noise_contour_half_mile_buffer_bool", -- O'Hare noise contour indicator (1/2 mile buffer). Indicates whether or not a parcel's centroid is within O'Hare's 65 DNL noise contour, buffered by 1/2 mile
    "school_secondary_district_name", -- School district (secondary) name, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "school_school_year", -- School year
    "school_data_year", -- School data year
    "tax_cook_municipality_num", -- Municipality number
    "econ_central_business_district", -- Chicago central business district number
    "econ_central_business_district_data_year", -- Chicago central business district data year
    "tax_tif_district_num", -- TIF district number
    "tax_cook_municipality_name", -- Municipality name
    "tax_tif_district_name", -- TIF district name
    "tax_school_unified_district_num", -- School district (unified) number, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_school_secondary_district_num", -- School district (secondary) number, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_school_unified_district_name", -- School district (unified) name, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_school_secondary_district_name", -- School district (secondary) name, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_school_elementary_district_num", -- School district (elementary) number, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_fire_protection_district_name", -- Fire protection district name
    "tax_school_elementary_district_name", -- School district (elementary) name, derived from tax district. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "tax_sanitation_district_num", -- Sanitation district number
    "tax_sanitation_district_name", -- Sanitation district name
    "tax_library_district_num", -- Library district number
    "tax_park_district_num", -- Park district number
    "chicago_industrial_corridor_name", -- Chicago industrial corridor name
    "tax_library_district_name", -- Library district name
    "tax_special_service_area_num", -- Special Service Area number
    "tax_fire_protection_district_num", -- Fire protection district number
    "tax_special_service_area_name", -- Special Service Area name
    "tax_districts_data_year", -- Data year for municipality, school, community college, fire, library, park, sanitary, special service area, and tax increment financing tax districts.
    "access_cmap_walk_id", -- CMAP walkability grid ID. From CMAP's ON TO 2050 spatial data files
    "tax_community_college_district_num", -- Community college district number
    "access_cmap_walk_nta_score", -- CMAP walkability score (no transit). From CMAP's ON TO 2050 spatial data files
    "tax_community_college_district_name", -- Community college district name
    "access_cmap_walk_total_score", -- CMAP walkability total score. From CMAP's ON TO 2050 spatial data files
    "school_unified_district_name", -- School district (unified) name, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "access_cmap_walk_data_year", -- CMAP walkability data year
    "school_unified_district_geoid", -- School district (unified) GEOID, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "misc_subdivision_id", -- Subdivision ID
    "school_elementary_district_name", -- School district (elementary) name, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "misc_subdivision_data_year", -- Subdivision data year
    "school_elementary_district_geoid", -- School district (elementary) GEOID, derived from Cook County and City of Chicago shapefiles. Chicago Public Schools are associated with attendance areas where suburban schools are associated with districts.
    "env_airport_noise_data_year", -- Airport continuous noise surface estimated data year
    "env_ohare_noise_contour_no_buffer_bool", -- O'Hare noise contour indicator (no buffer). Indicates whether or not a parcel's centroid is within O'Hare's 65 DNL noise contour
    "env_flood_fema_data_year", -- FEMA Special Flood Hazard Area (SFHA) data year
    "env_flood_fs_risk_direction", -- First Street flood risk direction
    "env_ohare_noise_contour_data_year", -- O'Hare noise contour data year. The "omp" value corresponds to the projected noise contour upon completion of the O'Hare Modernization Project
    "pin", -- Parcel Identification Number (PIN)
    "pin10", -- Parcel Identification Number (10-digit)
    "year", -- Tax year
    "class", -- Property class
    "triad_name", -- Triad name. Reassessment of property in Cook County is done within a triennial cycle, meaning it occurs every three years. The Cook County Assessor's Office alternates reassessments between triads: the north and west suburbs, the south and west suburbs and the City of Chicago.
    "triad_code", -- Triad code. Reassessment of property in Cook County is done within a triennial cycle, meaning it occurs every three years. The Cook County Assessor's Office alternates reassessments between triads: the north and west suburbs, the south and west suburbs and the City of Chicago.
    "township_name", -- Township name
    "township_code", -- Township code
    "nbhd_code", -- Assessor neighborhood code, first two digits are township, last three are neighborhood
    "tax_code", -- Tax district code, as seen on individual property tax bills (Not currently up-to-date)
    "zip_code", -- Property zip code
    "lon", -- Parcel centroid longitude
    "lat", -- Parcel centroid latitude
    "x_3435", -- Parcel centroid X coordinate (CRS 3435)
    "y_3435", -- Parcel centroid Y coordinate (CRS 3435)
    "census_block_group_geoid", -- Census block group GEOID
    "census_block_geoid", -- Census block GEOID
    "census_congressional_district_geoid", -- Census congressional district GEOID
    "census_county_subdivision_geoid", -- Census county subdivision GEOID
    "census_place_geoid", -- Census place GEOID
    "census_puma_geoid", -- Census PUMA GEOID
    "census_school_district_elementary_geoid", -- Census school district (elementary) GEOID
    "census_school_district_secondary_geoid", -- Census school district (secondary) GEOID
    "census_school_district_unified_geoid", -- Census school district (unified) GEOID
    "census_state_representative_geoid", -- Census state representative GEOID
    "census_state_senate_geoid", -- Census state senate GEOID
    "census_tract_geoid", -- Census tract GEOID
    "census_zcta_geoid", -- Census ZCTA GEOID
    "census_data_year", -- Census data year
    "census_acs5_congressional_district_geoid", -- Census ACS5 congressional district GEOID
    "census_acs5_county_subdivision_geoid", -- Census ACS5 county subdivision GEOID
    "census_acs5_place_geoid", -- Census ACS5 place GEOID
    "census_acs5_puma_geoid", -- Census ACS5 PUMA GEOID
    "census_acs5_school_district_elementary_geoid", -- Census ACS5 school district (elementary) GEOID
    "census_acs5_school_district_secondary_geoid", -- Census ACS5 school district (secondary) GEOID
    "census_acs5_school_district_unified_geoid", -- Census ACS5 school district (unified) GEOID
    "census_acs5_state_representative_geoid", -- Census ACS5 state representative GEOID
    "census_acs5_state_senate_geoid", -- Census ACS5 state senate GEOID
    "census_acs5_tract_geoid", -- Census ACS5 tract GEOID
    "census_acs5_data_year", -- Census ACS5 data year
    "cook_board_of_review_district_num", -- Board of Review district number
    "cook_board_of_review_district_data_year", -- Board of Review district data year
    "cook_commissioner_district_num", -- Commissioner district number
    "cook_commissioner_district_data_year", -- Commissioner district data year
    "cook_judicial_district_num", -- Judicial district number
    "cook_judicial_district_data_year", -- Judicial district data year
    "ward_num", -- Ward number
    "ward_chicago_data_year", -- Chicago ward data year
    "ward_evanston_data_year", -- Evanston ward data year
    "chicago_community_area_num", -- Chicago community area number
    "chicago_community_area_name", -- Chicago community area name
    "chicago_community_area_data_year", -- Chicago community area data year
    "chicago_industrial_corridor_num" -- Chicago industrial corridor number
FROM
    "datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j:latest"."assessor_parcel_universe"
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 datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j 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; sgrcan 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 cloneand sgr checkout.
Cloning Data
Because datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j: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 datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8jCheckout 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 datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j:latestThis will download all the objects for the latest tag of datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j 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 datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j: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 datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j:latestThis 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, datacatalog-cookcountyil-gov/assessor-parcel-universe-nj4t-kc8j is just another Postgres schema.