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 energy_star_certified_residential_dishwashers
table in this repository, by referencing it like:
"energystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f:latest"."energy_star_certified_residential_dishwashers"
or in a full query, like:
SELECT
":id", -- Socrata column ID
"depth_inches", -- Product depth when the door is shut and not including the handle.
"date_certified", -- The date on which the product was confirmed to meet the ENERGY STAR specification.
"tub_material", -- Tub material(s) could be stainless steel, plastic, hybrid, or other.
"communication_hardware_architecture", -- The Hardware Architecture describes the type of module/device within or external to the system needed for connection.
"pd_id", -- The ENERGY STAR Unique ID (ESUID) is a string of seven numbers EPA assigns to an ENERGY STAR model or set of models with unique performance characteristics. This ESUID is unique to both the model and product specification version and is assigned by EPA upon receipt of certification information from the certification body. Each row within the product list will have a unique ESUID. Developers may wish to use this ESUID to track information on certified models in their information systems.
"connected_capable", -- Indicates whether the model meets optional connected criteria as defined in the specification, which may include functions helpful to the electrical grid (standardized signals and responses to manage energy use) and those helpful to consumers, such as scheduling and energy reporting.
"upc", -- UPC codes provided by partners for ENERGY STAR certified products. The brand, model name and model number continue to serve as the identifiers used to establish certification. The UPC code data below is intended to aid in identification of ENERGY STAR models. UPC code data is not provided for all certified models.
"us_federal_standard_gallons_cycle", -- The mandatory water efficiency standards for residential dishwashers, established by DOE rulemaking activities and U.S. federal laws.
"connects_using", -- Provides guidance about what you need in your home to enable connected capabilities like smart phone control, e.g. ‘WiFi’ or Zigbee.
"markets", -- Includes products sold in the U.S. and/or Canada and other ENERGY STAR partner countries.
"date_available_on_market", -- The date that the model is available for purchase.
"drying_method", -- Drying method(s) applicable to the dishwasher may include air dry, condensation dry, fan-assisted dry, heated dry, mineral dry, and/or automatic door release.
"water_use_gallons_cycle", -- This is the estimated per cycle water use of the dishwasher under typical conditions, expressed as the number of gallons of water delivered to the machine during one cycle, as measured by the U.S. Department of Energy (DOE) test procedure, Code of Federal Regulations, Title 10, Subpart B, Section 430, Appendix C. Actual water consumption will vary depending on the settings chosen.
"capacity_maximum_number_of_place_settings", -- The maximum number of place settings as recommended by the manufacturer.
"soil_sensing_capability", -- A soil-sensing dishwasher means a dishwasher that has the ability to adjust any energy-consuming aspect of the normal cycle based on the soil load of the dishes.
"better_than_us_federal_standard_kwh_year", -- How much less energy the unit uses per year relative to the U.S. Federal standard, expressed as a percent.
"energy_star_model_identifier", -- A unique string of characters assigned by certification bodies (CBs) to identify a model or set of models with the same performance characteristics. This identifier should remain the same for a model even if it is recertified to a new version of an ENERGY STAR specification. This string of characters is determined by CBs and is not the ENERGY STAR Unique ID assigned by EPA.
"us_federal_standard_kwh_year", -- The mandatory energy standards for residential dishwashers, established by DOE rulemaking activities and U.S. federal laws.
"dr_protocol", -- Indicates which standardized protocol is used to send load management messages to the unit.
"additional_model_information", -- This column includes for the qualified model or family, family members, additional model names, model numbers and other identifying information associated with a product or family/series of products for sales and marketing purposes. Other identifying information includes, but is not limited to, SKUs, UPC codes, retail numbers, and/or descriptions of models included/not included in the reported Model Family.
"type", -- Type refers to whether the product is considered a standard-sized dishwasher or a compact-sized dishwasher. Standard-sized models can fit at least eight place settings and six serving pieces. Products that cannot fit those amounts are considered compact-sized models.
"model_number", -- A distinguishing, alphanumeric identifier, assigned to a product by the manufacturer or private labeler. The model number may include a wildcard that can be replaced by any letter or digit and still accurately capture what is covered by the model’s ENERGY STAR certification; an asterisk symbol (*) represents a letter, and a number symbol (#) a digit.
"better_than_us_federal_standard_gallons_cycle", -- How much less water the unit uses per cycle relative to the U.S. Federal standard, expressed as a percent.
"additional_product_features", -- Features applicable to the dishwasher may include hard food filter, self-cleaning filter, cycle status lights, 3rd rack, top controls, and/or front controls.
"width_inches", -- Product width.
"direct_on_premises_open_standard_based_interconnection", -- Connected appliances may or may not enable open-standards connectivity in the home. Consider the following illustrative examples: "Yes" An appliance that can directly communicate using Wi-Fi and OpenADR, or wired Ethernet and SEP 2.x; "No" An appliance that uses proprietary communications to/from the cloud, and is capable of supporting open-standards communications only in the cloud.
"brand_name", -- An identifier assigned by the manufacturer or private labeler to a product or family/series of products for sales and marketing purposes.
"meets_most_efficient_criteria", -- Indicates models meeting the Most Efficient criteria. The ENERGY STAR Most Efficient criteria recognizes the most efficient products among those that qualify for the ENERGY STAR. These exceptional products represent the leading edge in energy efficient products this year. For more information, please visit www.energystar.gov/mostefficient
"annual_energy_use_kwh_year" -- This is the estimated annual energy use of the dishwasher under typical conditions, including the machine energy used by the dishwasher during a dishwashing cycle, any additional energy used by a water heater to heat the water, and the energy used by the dishwasher while in standby mode. It is based on an annual usage of 215 loads per year, or around 4 per week, as referenced by the U.S. Department of Energy test procedure, Code of Federal Regulations, Title 10, Section 430, Subpart B, Appendix C. Actual energy consumption will vary depending on your usage patterns, including how often you run the dishwasher and what cycle you select.
FROM
"energystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f:latest"."energy_star_certified_residential_dishwashers"
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 energystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f
with SQL in under 60 seconds.
This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.energystar.gov. When you queryenergystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f: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
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 (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 clone
and sgr checkout
.
Mounting Data
This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.energystar.gov, 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 \
"energystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f" \
--handler-options '{
"domain": "data.energystar.gov",
"tables": {
"energy_star_certified_residential_dishwashers": "q8py-6w3f"
}
}'
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, energystar-gov/energy-star-certified-residential-dishwashers-q8py-6w3f
is just another Postgres schema.