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 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

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


or in a full query, like:

    ":id", -- Socrata column ID
    "neglect", -- # of substantiated investigations with a finding of Neglect.
    "of_reports_substantiated", -- # of investigations that were substantiated for child abuse and neglect.  Substantiated investigations have 4 types of finding:  Abuse, Neglect, Sexual Abuse, and Dependency. More information can be found in the following DSCYF Parent Handbook:
    "of_reports_investigated", -- # of hotline reports received that were screened in to investigation.
    "of_reports_received", -- Number of hotline reports made to Division of Family Services with allegations of child abuse and neglect.
    "fiscal_year", -- The fiscal year for this data.  The state fiscal year runs from July 1 – June 30.  For example, fiscal year 2015 = 7/1/14 – 6/30/15, fiscal year 2014 = 7/1/13 – 6/30/14.
    "abuse_non_sexual", -- # of substantiated investigations with a finding of Abuse (non-sexual).
    "dependency", -- # of substantiated investigations with a finding of Dependency. "Dependency" or "dependent child" means that a person: a. Is responsible for the care, custody, and/or control of the child; and b. Does not have the ability and/or financial means to provide for the care of the child; and b1. Fails to provide necessary care with regard to: food, clothing, shelter, education, health care, medical care or other care necessary for the child's emotional, physical or mental health, or safety and general well-being; or b2. The child is living in the home of an "adult individual" who fails to meet the definition of "relative" in this section on an extended basis without an assessment by DSCYF, or its licensed agency; or b3. The child has been placed with a licensed agency which certifies it cannot complete a suitable adoption plan.
    "sex_abuse" -- # of substantiated investigations with a finding of Sexual Abuse.
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/division-of-family-services-intake-and-bsk5-8s98 with SQL in under 60 seconds.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL"

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/division-of-family-services-intake-and-bsk5-8s98: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/division-of-family-services-intake-and-bsk5-8s98

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/division-of-family-services-intake-and-bsk5-8s98:latest

This will download all the objects for the latest tag of delaware-gov/division-of-family-services-intake-and-bsk5-8s98 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/division-of-family-services-intake-and-bsk5-8s98: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/division-of-family-services-intake-and-bsk5-8s98: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/division-of-family-services-intake-and-bsk5-8s98 is just another Postgres schema.

Related Documentation: