wa-gov/candidate-and-committee-registrations-iz23-7xxj
Loading...

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

"wa-gov/candidate-and-committee-registrations-iz23-7xxj:latest"."candidate_and_committee_registrations"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "committee_category", -- This column contains a category for a political committee (PAC) for example: Continuing Political Committee, Party Committee, committees Affiliated with a party, Single election year committee, School levy committee, Local ballot initiative, Caucus political committee, Statewide Initiative committee.
    "position", -- The position associated with an office. This field typically applies to jurisdictions that have multiple positions or seats. This field does not apply to political committees.
    "party", -- The political party as declared by the candidate on their C1 registration form. Contains only parties recognized by Washington State law.
    "jurisdiction_code", -- This is a unique code representing a jurisdiction with a reporting requirement.
    "jurisdiction", -- The political jurisdiction associated with the office of a candidate.
    "treasurer_address", --  The address of the treasurer as reported on the C1pc registration.
    "candidate_committee_phone", -- The committee phone number. In the case of a candidate, this is the phone number of the candidate, not the candidate's committee.
    "committee_address", -- This field value of the most recent registration for the committee. The street address of the committee. For candidates, this is the address provided for the candidate committee, not necessarily the address of the candidate.
    "office", --  The office sought by the candidate.
    "candidate_email", --  The candidate’s personal e-mail. This email may be the same as the candidate’s committee email.
    "office_code", --  The numeric code that defines the office. For example the office code 31 defines the office of Mayor. Combined with the jurisdiction_code it defines a particular office such as Mayor of Olympia.
    "ballot_number", --  The ballot number assigned to a Statewide ballot Initiative. Local ballot initiative will probably not have a ballot number because each county labels their initiatives starting at 1. So it is potentially possible for there to be 39 proposition 1's.
    "jurisdiction_type", --  The type of jurisdiction this office represents: Statewide, Local, Judicial, etc.
    "bonafide_type", -- The type of bonafide party committee, for example State Party, County Party, Leg Dist Party, party Associated committee.
    "ballot_committee", -- An X in this column designates the committee as a ballot committee.
    "bonafide_committee", --  An X in this column means this is a bona fide party committee
    "url", -- A link to a registration version of the registration report as it was filed to the PDC.
    "treasurer_zip", -- The zip code of the treasurer as reported on the C1pc registration.
    "party_code", -- Unique code that represents a candidates party. i.e. R represents Republican.
    "receipt_date", -- The postmark date of the relevant registration.
    "committee_state", --  This field value of the most recent registration for the committee. The state of the committee. For candidates, this is the address provided for the candidate committee, not necessarily the address of the candidate.
    "election_year", -- The year of the election for a candidate or single-year committee participating in a particular election. The calendar year for a continuing political committee.
    "filer_id", -- The unique id assigned to a candidate or political committee. The filer id is consistent across election years with the exception that an individual running for a second office in the same election year will receive a second filer id. There is no correlation between the two. For a candidate and single-election-year committee such as a ballot committee, the combination of filer_id and election_year uniquely identifies a campaign.
    "exempt_nonexempt", --  This column designate whether a party committee is exempt from contribution limits or is non-exempt which means it is subject to limits when giving contributions.
    "for_or_against", -- Designates whether the committee supports or opposes the initiative.
    "jurisdiction_county", -- The county associated with the jurisdiction of a candidate. Multi-county jurisdictions are reported as the primary county. This field will be empty when a candidate jurisdiction is statewide.
    "treasurer_state", -- The state of the treasurer as reported on the C1pc registration.
    "treasurer_city", -- The city of the treasurer as reported on the C1pc registration.
    "other_pac", -- An X in this column designates the committee as a Continuing Political Committee.
    "committee_zip", -- This field value of the most recent registration for the committee. The zip code of the committee. For candidates, this is the address provided for the candidate committee, not necessarily the address of the candidate.
    "treasurer_name", -- Treasurer Name
    "filer_type", -- This column designates if this is a candidate committee (CA) or a political committee (CO).
    "election_date", -- This is the calendar month/day/year of the election where a candidate is elected to office or the date of the election for a ballot initiative committee.
    "committee_email", --  This field value of the most recent registration for the committee. The email address of the committee. For candidates, this is the email address provided for the candidate committee, not necessarily the email address of the candidate.
    "id", -- This is the unique identifier that represents this registration.
    "political_committee_type", -- This column designates the persuasion of the PAC; for example, Business, union, PAC, etc.
    "treasurer_phone", -- The phone number of the treasurer as reported on the C1pc registration.
    "committee_id", -- This is the unique identifier assigned to the committee.
    "candidate_id", -- This is a unique identifier assigned to the candidate.
    "filer_name", -- The candidate name as reported on the form C1 candidate registration or the political committee name as reported on the C1pc registration at the time they submitted the registration.
    "committee_acronym", --  This field value of the most recent registration for the committee. If a political committee is known by an abbreviation it is placed in this column. This acronym is optional. An example would be the WA Education Association, whose acronym is WEA.
    "committee_city", -- This field value of the most recent registration for the committee. The city of the committee. For candidates, this is the address provided for the candidate committee, not necessarily the address of the candidate.
    "committee_county" -- This field value of the most recent registration for the committee. The county of the committee. For candidates, this is the address provided for the candidate committee, not necessarily the address of the candidate.
FROM
    "wa-gov/candidate-and-committee-registrations-iz23-7xxj:latest"."candidate_and_committee_registrations"
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/candidate-and-committee-registrations-iz23-7xxj with SQL in under 60 seconds.

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, 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 wa-gov/candidate-and-committee-registrations-iz23-7xxj: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 wa-gov/candidate-and-committee-registrations-iz23-7xxj

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 wa-gov/candidate-and-committee-registrations-iz23-7xxj:latest

This will download all the objects for the latest tag of wa-gov/candidate-and-committee-registrations-iz23-7xxj 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 wa-gov/candidate-and-committee-registrations-iz23-7xxj: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 wa-gov/candidate-and-committee-registrations-iz23-7xxj: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, wa-gov/candidate-and-committee-registrations-iz23-7xxj is just another Postgres schema.

Related Documentation:

Loading...