wa-gov/electric-vehicle-title-and-registration-activity-rpr4-cgyd
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 electric_vehicle_title_and_registration_activity table in this repository, by referencing it like:

"wa-gov/electric-vehicle-title-and-registration-activity-rpr4-cgyd:latest"."electric_vehicle_title_and_registration_activity"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "_2019_hb_2042_sale_price_value_requirement", -- This field displays ‘Meets title transaction requirement’ when the vehicle sale price/value was $45,000 or less for new vehicles, or $30,000 or less for used vehicles. Otherwise, it will display the reason why the requirement is not met.
    "legislative_district", -- The specific section of Washington State that the vehicle's owner resides in, as represented in the state legislature.
    "hybrid_vehicle_electrification_fee_paid", -- The Hybrid Vehicle Electrification Fee is charged to some electric vehicles when they renew their registration. This indicates if it was collected during the transaction.
    "electric_vehicle_fee_paid", -- The Electric Vehicle Fee is charged to some electric vehicles when they renew their registration. This indicates if it was collected during the transaction.
    "electric_utility", -- This is the electric power retail service territories serving the address of the registered vehicle. All ownership types for areas in Washington are included: federal, investor owned, municipal, political subdivision, and cooperative. If the address  for the registered vehicle falls into an area with overlapping electric power retail service territories then a single pipe | delimits utilities of same TYPE and a double pipe || delimits utilities of different types. We combined vehicle address and Homeland  Infrastructure Foundation Level Database (HIFLD) (https://gii.dhs.gov/HIFLD) Retail_Service_Territories feature layer using a geographic information  system to assign values for this field. Blanks occur for vehicles with addresses outside of Washington or for addresses falling into areas in Washington not containing a mapped electric power retail service territory in the source data. 
    "dol_vehicle_id", -- A unique identification number for each vehicle present in Transactions dataset. Transactions done on the same vehicle will have the same DOL Vehicle ID.
    "census_tract_2020", -- The census tract identifier 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 Geographic Identifier (GEOID).   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 
    "transportation_electrification_fee_paid", -- The Transportation Electrification Fee is charged to some electric vehicles when they renew their registration. This indicates if it was collected during the transaction.
    "meets_2019_hb_2042_sale_price_value_requirement", -- True (or checked)  = The vehicle sale price/value was $45,000 or less for new vehicles, or $30,000 or less for used vehicles. Otherwise, False.
    "zip", -- The 5 digit zip code that the vehicle's owner is listed to reside within.
    "state_of_residence", -- This describes the residential or business location of the primary vehicle owner.
    "city", -- The City that the vehicle's owner is listed to reside within.
    "county", -- The County that the vehicle's owner is listed to reside within.
    "transaction_year", -- The year upon which a transaction was recorded into Department of Licensing's computer system.
    "transaction_date", -- The day upon which a transaction was recorded into Department of Licensing's computer system.
    "transaction_type", -- The category of activity that was performed.
    "base_msrp", -- This is the lowest Manufacturer's Suggested Retail Price (MSRP) for any version of the model in question.
    "date_of_vehicle_sale", -- The day on which the vehicle changed ownership. 
    "sale_price", -- The amount that was reported to have been paid for a vehicle. A value of zero indicates that the sale price was not available.
    "new_or_used_vehicle", -- If a vehicle is being sold by its manufacturer to its first owner, it is considered 'new'. Otherwise it is considered 'used'.
    "odometer_code", -- The type of odometer value that was taken at the time of a Title Transaction.
    "odometer_reading", -- The odometer value taken at the time of the Title Transaction.
    "electric_range", -- This tells how far a vehicle can travel purely on its electric charge.
    "vehicle_primary_use", -- This describes the primary intended use of the vehicle. 
    "model", -- The model of the vehicle, determined by decoding the Vehicle Identification Number (VIN).
    "make", -- The manufacturer of the vehicle, determined by decoding the Vehicle Identification Number (VIN).
    "model_year", -- The model year of the vehicle, determined by decoding the Vehicle Identification Number (VIN).
    "vin_1_10", -- The 1st 10 characters of each vehicle's Vehicle Identification Number (VIN).
    "electric_vehicle_type" -- This distinguishes the vehicle as all electric,  plug-in hybrid, or hydrogen powered.
FROM
    "wa-gov/electric-vehicle-title-and-registration-activity-rpr4-cgyd:latest"."electric_vehicle_title_and_registration_activity"
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/electric-vehicle-title-and-registration-activity-rpr4-cgyd 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/electric-vehicle-title-and-registration-activity-rpr4-cgyd: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/electric-vehicle-title-and-registration-activity-rpr4-cgyd" \
  --handler-options '{
    "domain": "data.wa.gov",
    "tables": {
        "electric_vehicle_title_and_registration_activity": "rpr4-cgyd"
    }
}'

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/electric-vehicle-title-and-registration-activity-rpr4-cgyd is just another Postgres schema.