wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh
Icon for Socrata external plugin

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

"wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh:latest"."vehicle_registration_transactions_by_department_of"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "owner_type", -- Describes if a vehicle is registered by one or more individuals, or a business
    "fuel_type_secondary", -- An additional source of power that is used to propel the vehicle
    "gross_vehicle_weight_rating_class", -- A numeric classification (1-8) for the maximum operating weight of a vehicle including its chassis, body, engine, engine fluids, fuel, accessories, driver, passengers and cargo. Typically associated with Trucks.
    "plate_background", -- The background on the issued plate, either standard or a special plate
    "electrification_level", -- Describes how effectively a vehicle uses electricity to power it. A Mild Hybrid electric vehicle uses an electric battery and electric motor to suppliment the power of an internal combustion engine (ICE) but cannot power the vehicle using electricity alone. The only energy source added externally for this type of vehicle is a petroleum product. A Strong Hybrid electric vehicle also uses an electric battery and electric motor to suppliment the power of an internal combustion engine (ICE). It can power the vehicle using electricity alone. The only energy source added externally for this type of vehicle is a petroleum product. A Plug-in Hybrid electric vehicle (PHEV) uses an electric battery and electric motor as an alternative power source to its internal combustion engine (ICE). It can be powered using electricity alone, and can also be charged by an external source of electricity. An Electric Vehicle (EV) only uses electricity as a source of power.
    "vehicle_primary_use", -- The way a vehicle was registered to be used through Department of Licensing; similar to ‘use class’
    "primary_color", -- The color of the vehicle.  Color is not required and may not be collected when registering or titling a vehicle.
    "model_year", -- The model year of the vehicle, determined by decoding the Vehicle Identification Number (VIN)
    "model", -- The model of the vehicle, determined by decoding the Vehicle Identification Number (VIN)
    "transaction_channel", -- Describes how the activity was performed Online: the transaction completed remotely using a Department of Licensing internet-based applications In-person: the transaction was completed by a person while visiting a Department of Licensing location By mail: the transaction was remotely requested and paid for via the United States Postal Service (USPS) or a mail courier
    "make", -- The manufacturer of the vehicle, determined by decoding the Vehicle Identification Number (VIN)
    "start_of_month", -- The month and year in which a transaction was recorded into Department of Licensing's computer system
    "vehicle_type", -- The category of vehicle based on its physical appearance and/or intended use, as defined by the manufacturer
    "zip_code", -- The 5 digit postal code used by the United States Postal Service (USPS) that a vehicle's owner is listed to reside within
    "transaction_type", -- The category of activity that was performed, as defined by Department of Licensing
    "state", -- This describes the residential or business location of the primary vehicle owner.
    "fuel_type_primary", -- The source of power that is most often used to power a vehicle
    "county", -- The geographic region of a state that a vehicle's owner is listed to reside within
    "_2020_census_tract", -- The  Geographic Identifier (GEOID) is a combination of the state, county, and census tract codes as assigned by the United States Census Bureau in the 2020 census, also known as Census Tract. More information can be found here:  https://www.census.gov/programs-surveys/geography/about/glossary.html#par_textimage_13  https://www.census.gov/programs-surveys/geography/guidance/geo-identifiers.html
    "plate_configuration", -- The configuration of the plate number. The field displays either a standard or personalized configuration
    "gross_vehicle_weight_rating_range", -- The weight range (in pounds) of the maximum operating weight of a vehicle including its chassis, body, engine, engine fluids, fuel, accessories, driver, passengers, and cargo. Typically associated with Trucks.
    "vehicle_record_count" -- A count of the vehicle registrations based on the fields defined in this dataset
FROM
    "wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh:latest"."vehicle_registration_transactions_by_department_of"
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 wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.wa.gov. When you querywa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh: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 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 (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 data.wa.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 \
  "wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh" \
  --handler-options '{
    "domain": "data.wa.gov",
    "tables": {
        "vehicle_registration_transactions_by_department_of": "brw6-jymh"
    }
}'

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, wa-gov/vehicle-registration-transactions-by-department-of-brw6-jymh is just another Postgres schema.