datahub-usac/erate-invoices-and-authorized-disbursements-fcc-jpiu-tj8h
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 erate_invoices_and_authorized_disbursements_fcc table in this repository, by referencing it like:

"datahub-usac/erate-invoices-and-authorized-disbursements-fcc-jpiu-tj8h:latest"."erate_invoices_and_authorized_disbursements_fcc"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "form_498_applicant_id", -- FCC Form 498 ID associated with an FCC Form 472. 
    "inv_crtfctn_dt", -- Date an Applicant Invoice (BEAR) was certified. 
    "inv_received_date", -- Date and time the invoice was received by USAC.
    "inv_total_requested_amt", -- The total requested amount for all invoice line items for an invoice. 
    "funding_year", -- The funding year for the funding request number (FRN) associated with the invoice line item.
    "form_471_app_num", -- FCC Form 471 application number for the FRN associated with the invoice line item.
    "billed_entity_state", -- The physical state for billed entity. 
    "customer_billed_dt", -- The first date the service or product was billed for by the service provider.
    "approved_inv_line_amt", -- Total approved authorized disbursement amount that will be paid by USAC to the service provider or applicant for the invoice line. 
    "inv_tot_undiscounted_amt", -- The total undiscounted amount for invoice line item eligible services.
    "reimb_request_decision_codes", -- Unique code/identifier   for the invoice line item decision shown on the USAC remittance statement or notification letter. 
    "shipping_date_to_customer", -- The date non-recurring services or a product was delivered to the customer. 
    "reimb_request_decision_descrip_plain", -- Plain language explanation for the invoice line item decision description shown on the USAC remittance statement or notification letter. 
    "applicant_type", -- The applicant type for the billed entity, e.g., school, school district, library, library system, or consortia.
    "inv_line_num", -- Unique identifier for the invoice detailed line.
    "billed_entity_number", -- The billed entity number associated with the FRN.
    "consultant_registration_number", -- Consultant registration number from the FCC Form 471. 
    "bill_frequency", -- Code identifying the frequency that the service provider will bill/invoice the applicant and USAC.
    "submission_method", -- Indicates the method used to submit an invoice.
    "inv_line_item_status", -- Status of invoice line item. 
    "chosen_category_of_service", -- The category of service for the FRN.
    "funding_request_number", -- The funding request number for the invoice line item.
    "invoice_type", -- Identifies the invoice type as either "Applicant" for Billed Entity Applicant Reimbursement (BEAR) invoices (FCC Form 472) or "Service Provider" for Service Provider invoices (SPI)   (FCC Form 474).
    "inv_line_completion_date", -- The date the invoice line item was processed and authorized for disbursement.
    "inv_service_provider_id_number_spin", -- The service provider identification number associated to a service provider on an invoice. 
    "invoice_delivery_deadline_dt", -- The invoice deadline for the FRN.
    "service_type", -- The service type for the FRN. 
    "requested_inv_line_amt", -- The total discounted dollar amount requested on the individual invoice line for payment by USAC for services rendered to a school or library.
    "invoice_id", -- Unique identifier of an invoice representing the bill to be paid by USAC.
    "billed_entity_name", -- The billed entity name associated with the FRN.
    "consultant_name", -- Consulting firm for the FRN.  
    "discount_rate", -- The approved discount rate for the FRN.
    "reimb_request_decision_descrip", -- The invoice line item decision and rationale shown on the USAC remittance statement or notification letter. 
    "form_nickname", -- Nickname given by a service provider when filling its FCC Form 474, or by applicant when filling its FCC Form 472.
    "inv_service_provider_name", -- The service provider name associated to the service provider an invoice. 
    "billed_entity_number_applicant_invoice", -- The billed entity number (BEN) of the applicant submitting a BEAR invoice on the FCC Form 472. 
    "billed_entity_name_applicant_invoice" -- The billed entity name of the applicant submitting a BEAR invoice on the FCC Form 472. 
FROM
    "datahub-usac/erate-invoices-and-authorized-disbursements-fcc-jpiu-tj8h:latest"."erate_invoices_and_authorized_disbursements_fcc"
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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h 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 datahub-usac/erate-invoices-and-authorized-disbursements-fcc-jpiu-tj8h: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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h

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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h:latest

This will download all the objects for the latest tag of datahub-usac/erate-invoices-and-authorized-disbursements-fcc-jpiu-tj8h 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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h: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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h: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-invoices-and-authorized-disbursements-fcc-jpiu-tj8h is just another Postgres schema.

Related Documentation:

Loading...