Query the Data Delivery Network
Query the DDNThe 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 erate_request_for_discount_on_services_basic
table in this repository, by referencing it like:
"datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen:latest"."erate_request_for_discount_on_services_basic"
or in a full query, like:
SELECT
":id", -- Socrata column ID
"full_time_students", -- Number of fulltime student enrollment.
"org_city", -- Applicant city
"receiving_funds_directly", -- Indicates whether an applicant is receiving any of the funds directly from a service provider listed on any of the FCC Forms 471 filed by this Billed Entity for this funding year.
"aut_phone_ext", -- Phone extension of the person authorized to certify the FCC Form 471.
"aut_title", -- Title of the person authorized to certify the FCC Form 471.
"cnct_email", -- Email Address of the main contact provided by the applicant on the FCC Form 471.
"cnct_first_name", -- First name of the main contact provided by the applicant on the FCC Form 471
"nickname", -- Nickname given to an FCC Form 471 by an applicant.
"nslp_percentage", -- Percentage of NSLP (National School Lunch Program) students for the school or school district.
"org_zipcode", -- Applicant zip code
"c2_discount", -- Discount rate applied to Category Two services for the applicant on the FCC Form 471 application. Services discounted by this rate include Internal Connections, Managed Internal Broadband Services (MIBS) and/or Basic Maintenance of Internal Connections.
"is_urban", -- Urban/rural status of the billed entity for the purposes of calculating discounts.
"total_eligible_nslp_students", -- Total eligible National School Lunch Program (NSLP) students. It can be used to filter applications submitted by the total eligible NSLP.
"file_url", -- Link to download the original submitted FCC Form 471 as a PDF.
"chosen_category_of_service", -- Category of service for the funding requested.
"longitude", -- Longitude of the applicant.
"latitude", -- Latitude of the applicant.
"has_service_provider_listed", -- Indicates whether a service provider listed on any of the FCC Forms 471 assisted the Form's Billed Entity in locating funds needed to pay non-discounted share.
"funding_request_amount", -- Funding request amount for applicant across all FRNs.
"aut_zipcode", -- Zip code extension of the person authorized to certify the FCC Form 471.
"aut_state", -- State of the person authorized to certify the FCC Form 471.
"aut_last_name", -- Last name of the person authorized to certify the FCC Form 471.
"epc_organization_id", -- E-Rate Billed Entity Number for the FCC Form 471 applicant.
"is_certified_in_window", -- Indicates whether the application has been certified during the FCC Form 471 application filing window.
"organization_entity_type_name", -- Applicant type including school, school district, library, library system, or consortium.
"form_471_status_name", -- Current status of the FCC Form 471. It can be used to filter the following statuses: Certified and Committed.
"form_version", -- Indicates whether the form version of the application is "current" or "original." It can be used to aggregate the data between current and original applications. "Current" is the view of the form processed by USAC. "Original" is the view of the form originally submitted by the applicant upon certification.
"application_number", -- Unique application number generated at the time an applicant begins to file the FCC Form 471 application. Applicants can request funding for multiple services under the same application number.
"cnct_last_name", -- Last name of the main contact provided by the applicant on the FCC Form 471
"org_phone_ext", -- Applicant phone number extension.
"aut_employer", -- Employer of the person authorized to certify the FCC Form 471.
"aut_city", -- City of the person authorized to certify the FCC Form 471.
"aut_zipcode_ext", -- Zip code extension of the person authorized to certify the FCC Form 471.
"c1_voice_discount", -- Discount rate applied to Voice services for the applicant on FCC Form 471 application. This discount is separate from the one applied to Data Transmission and/or Internet Access Services.
"funding_year", -- Funding year for the FCC Form 471.
"org_state", -- Applicant state.
"organization_name", -- Name of the applicant's organization.
"org_address1", -- Applicant street address line 1
"org_address2", -- Applicant street address line 2
"org_zipcode_ext", -- Applicant zip code extension.
"org_phone", -- Applicant phone number.
"org_email", -- Applicant email address.
"fcc_registration_number", -- 10-digit number that the FCC assigns to a business or individual that registers with the FCC.
"cnct_middle_initial", -- Middle initial of the main contact provided by the applicant on the FCC Form 471
"cnct_phone", -- Phone number of the main contact provided by the applicant on the FCC Form 471
"cnct_phone_extension", -- Phone number extension of the main contact provided by the applicant on the FCC Form 471
"aut_first_name", -- First name of the person authorized to certify the FCC Form 471.
"aut_middle_initial", -- Middle initial of the person authorized to certify the FCC Form 471.
"aut_address1", -- Address line 1 of the person authorized to certify the FCC Form 471.
"aut_address2", -- Address line 2 of the person authorized to certify the FCC Form 471.
"aut_phone", -- Phone number of the person authorized to certify the FCC Form 471.
"aut_email", -- Email address of the person authorized to certify the FCC Form 471.
"certified_datetime", -- Exact date and time (EST) when the form was certified.
"c1_discount", -- Discount rate applied to Category One services for the applicant on the FCC Form 471 application. Services discounted by this rate include Internet Access Services and / or Data Transmission but do not include Voice Services.
"pre_discount_eligible_amount", -- Total Funding Year Pre-Discount Eligible Amount
"non_discount_share", -- Total amount necessary for the applicant to pay the non-discount share of eligible and any ineligible amounts
"last_modified_timestamp", -- Time/date stamp of when the application was last modified.
"congressional_district" -- Congressional district in which the applicant is located.
FROM
"datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen:latest"."erate_request_for_discount_on_services_basic"
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 datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen
with SQL in under 60 seconds.
Query Your Local Engine
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; sgr
can 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 clone
and sgr checkout
.
Cloning Data
Because datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen: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 datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen
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 datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen:latest
This will download all the objects for the latest
tag of datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen
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 datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen: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 datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen: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, datahub-usac/erate-request-for-discount-on-services-basic-9s6i-myen
is just another Postgres schema.