• bic
  • cdot
  • colorado
  • colorado department of transportation
  • gis
  • + 6

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


or in a full query, like:

    ":id", -- Socrata column ID
    "the_geom", -- Auto generated field containing the geometry of each item. Users note that this field may or may not be completely accurate. It is recommended for the user to run a separate analysis.
    "route", -- A Unique (3 Number - 1 Letter) Highway Identification Code or Designating for a State Highway, Business Route, U.S. Route or Tolled Facility. Odd numbers typically run North and South and Even numbers typically Run East and West.
    "refpt", -- A Linear Reference Number or Address Key (to the Thousandth of a Mile) Representing the Starting Point of a roadway segment. A Unique Landmark Location (not the running measure) or (maybe a one-time true measure) of a roadway segment along a State Route.
    "endrefpt", -- A Linear Reference Number or Address Key (to the Thousandth of a Mile) Representing the Ending Point of a roadway Segment. A Unique Landmark Location (not the running measure) or (maybe a one-time true end measure) of a segment along a State Route.
    "length_", -- The Centerline Segment Length or Segment Distance (in Miles) to the Thousandth of a Mile. Length_ is the distance from one Road Segment to the next Road Segment. Length_ is a dimension or measurement that is carried out 3-decimal places.
    "updateyr", -- The last calendar year in which the data was updated.
    "aadt", -- The annual average daily traffic count for the segment. (Total of all vehicles counted in a year divided by 365 days)
    "aadtcomb", -- The AADT consisting of combination trucks (3 or more axles-single trailer or multiple trailers).
    "aadtderiv", -- A Domained Value Element (AADTDeriv) indicating the Code Associated with the Factoring Method used in calculating the AADT determination Value.
    "aadtsingle", -- The AADT consisting of single unit trucks (vehicles larger than pickup trucks built on a single chassis).
    "aadttrucks", -- Annual Average Daily Traffic for Trucks
    "aadtyr", -- The calendar year (YYYY) in which the annual average daily traffic count applies for the highway segment.
    "calyr", -- The last calendar year in which the data was updated.
    "countyear", -- The year the data was recorded
    "dd", -- Directional Distribution -The percentage of the design hour value flowing in the peak direction.
    "dhv", -- The 30th highest annual hourly traffic volume expressed as a percentage of AADT
    "edla", -- Equivalent Daily Load Axle
    "offpktrk", -- The Peak percent of AADT that is composed of trucks of all types. Calculated by taking the number of trucks divided by the AADT
    "pctoffpkco", -- Percentage of AADT for Combination Trucks During Off-Peak Periods
    "pctoffpksu", -- Percentage of AADT for Single Unit Trucks During Off-Peak Periods
    "pctpksu", -- Percentage of AADT for single unit trucks during the Peak Hour.
    "pctpkcomb", -- Percentage of AADT for Combination Trucks During the Peak Hour.
    "pktrk", -- The Peak percent of AADT that is composed of trucks of all types. Calculated by taking the number of trucks divided by the AADT
    "routecapac", -- The maximum number of vehicles which has a reasonable expectation of passing over a given section of lane or roadway during a given time period under prevailing roadway and traffic conditions per the Highway Capacity Manual.
    "vcratio", -- The hourly traffic volume divided by the capacity of the segment. Thus, the volume/capacity ratio measure can be assumed to measure capacity sufficiency and delay is a measure of the quality of service.
    "vcratio20", -- The 20 year projection for the VCRATIO value.
    "yr20factor", -- A traffic forecasting statistic that gives an estimate of AADT for 20 years in the future.
    "roadterrai", -- A Domained Value Element (terrain 0-3) used to identify the Predominant type of terrain through which the road segment passes as specified by AASHTO.
    "seasonalgr", -- A Domained Numeric Designation (seasonalGroupID, 1-7) indicating the Coded Value associated with a list of Seasonal Variations used for short term data calculations.
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 colorado-gov/highway-traffic-counts-in-colorado-2018-56kc-gpid with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at When you querycolorado-gov/highway-traffic-counts-in-colorado-2018-56kc-gpid: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

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

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 (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 cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by, 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 \
  "colorado-gov/highway-traffic-counts-in-colorado-2018-56kc-gpid" \
  --handler-options '{
    "domain": "",
    "tables": {
        "highway_traffic_counts_in_colorado_2018": "56kc-gpid"

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, colorado-gov/highway-traffic-counts-in-colorado-2018-56kc-gpid is just another Postgres schema.

Related Documentation: