delaware-gov/grants-for-weatherization-services-bggt-57c5
Loading...

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 grants_for_weatherization_services table in this repository, by referencing it like:

"delaware-gov/grants-for-weatherization-services-bggt-57c5:latest"."grants_for_weatherization_services"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "client_reference", -- Unique identifier of record of weatherization assistance.
    "final_inspector", -- Name of the person who performed the final inspection of the services provided.
    "hs_amount_rggi_wap", -- Amount of the total health and safety cost that came from RGGI WAP funds.
    "other_occupants", -- Number of other persons living in the housing unit.
    "unit_stories", -- Number of stories of the housing unit.
    "agency", -- Agency/partner through which the weatherization services were provided. 
    "elderly", -- Number of elderly persons living in the housing unit.
    "housing_unit_type", -- Type of housing unit. 
    "county", -- County in which the housing unit is located.
    "city", -- City in which the housing unit is located.
    "program_year", -- Program year in which the final inspection of the services was performed. The program year for this program runs from April 1 to March 31. Program year 2017, for example, ran from April 1, 2017, through March 31, 2018. 
    "invoice_date", -- Date of invoice from agency to DNREC.
    "total_occupants", -- Total number of persons living in the housing unit.
    "primary_heating_fuel", -- Primary type of fuel used to heat the housing unit.
    "utility", -- Utility that provides services to the housing unit.
    "unit_year_built", -- Year that the housing unit was built.
    "auditor", -- Name of the person who performed the audit of the housing unit.
    "wx_contractor", -- Name of the weatherization contractor who performed the weatherization services.
    "hvac_contractor", -- Name of the HVAC contractor who performed HVAC services.
    "pre_wx_test_cfm", -- Amount of air leakage found in tests, in cubic feet per minute, before weatherization services.
    "post_wx_test_cfm", -- Amount of air leakage found in tests, in cubic feet per minute, after weatherization services.
    "total_cfm_difference", -- Amount of air leakage, measured in cubic feet per minute, saved through weatherization services.
    "funding_assignment", -- Funding source, or combination of funding sources, used to pay for weatherization services. They are: WAP BASE (federal Dept. of Energy grant funds for the Weatherization Assistance Program), LIHEAP (federal DHHS grant funds for weatherizing homes), UTILITY (state funds received from Delmarva Power ratepayers designated for weatherizing homes), and RGGI WAP (state funds received through Regional Greenhouse Gas Initiative auctions for weatherization). Prior to 2017, projects for which more than one funding source was used were reported as two records, with identical Client Reference numbers. For details such as numbers of occupants are only reported on the first record.  
    "total_invoice_cost", -- Total cost of all weatherization and health and safety services provided to the housing unit. Health and safety costs are those related services not deemed "weatherization" (such as CO and smoke detectors, electrical updates, and ventilation improvements).
    "po_amount_wap_base", -- Amount of the total weatherization cost that came from WAP BASE funds.
    "po_amount_rggi_wap", -- Amount of the total weatherization cost that came from RGGI WAP funds.
    "po_amount_wap_utility", -- Amount of the total weatherization cost that came from WAP UTILITY funds.
    "po_amount_liheap", -- Amount of the total weatherization cost that came from LIHEAP funds.
    "hs_amount_wap_base", -- Amount of the total health and safety cost that came from WAP BASE funds.
    "hs_amount_wap_utility", -- Amount of the total health and safety cost that came from WAP UTILITY funds.
    "hs_amount_liheap", -- Amount of the total health and safety cost that came from LIHEAP funds.
    "disabled_occupants", -- Number of disabled persons living in the housing unit.
    "furnace_replacement", -- Was the furnace replaced? (Y or N)
    "native_american_occupants", -- Number of Native American persons living in the housing unit.
    "unit_ownership", -- Is the housing unit owned or rented?
    "children", -- Number of children living in the housing unit.
    "zip", -- ZIP Code of the housing unit.
    "unit_size" -- Size, in square feet, of the housing unit.
FROM
    "delaware-gov/grants-for-weatherization-services-bggt-57c5:latest"."grants_for_weatherization_services"
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 delaware-gov/grants-for-weatherization-services-bggt-57c5 with SQL in under 60 seconds.

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, 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 delaware-gov/grants-for-weatherization-services-bggt-57c5: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 delaware-gov/grants-for-weatherization-services-bggt-57c5

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 delaware-gov/grants-for-weatherization-services-bggt-57c5:latest

This will download all the objects for the latest tag of delaware-gov/grants-for-weatherization-services-bggt-57c5 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 delaware-gov/grants-for-weatherization-services-bggt-57c5: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 delaware-gov/grants-for-weatherization-services-bggt-57c5: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, delaware-gov/grants-for-weatherization-services-bggt-57c5 is just another Postgres schema.

Related Documentation:

Loading...