ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6
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 public_assistance_pa_caseloads_and_expenditures table in this repository, by referencing it like:

"ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6:latest"."public_assistance_pa_caseloads_and_expenditures"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "total_temporary_assistance_expenditures", -- Total Temporary Assistance Expenditures.
    "non_maintenance_of_effort_recipients", -- Safety Net Assistance FNP Non-Maintenance of Effort Recipients.
    "safety_net_assistance_federally_participating_expenditures", -- Safety Net Assistance FP Expenditures.
    "total_temporary_assistance_recipients", -- Total Temporary Assistance Recipient count.
    "non_maintenance_of_effort_children", -- Safety Net Assistance FNP Non-Maintenance of Effort Children.
    "safety_net_federally_non_participating_cases", -- Safety Net Assistance Federally Non-Participating and Family Assistance Federally Non-Participating Cases.  Includes childless adult cases, cases exceeding TANF time limit, qualified aliens in USA less than 5 years, and non-disabled 2-parent families.
    "total_temporary_assistance_children", -- Total Temporary Assistance Children.
    "family_assistance_federally_participating_children", -- Family Assistance FP Children.
    "non_maintenance_of_effort_expenditures", -- Safety Net Assistance FNP Non-Maintenance of Effort Expenditures.
    "family_assistance_federally_participating_adults", -- Family Assistance FP Adults.
    "maintenance_of_effort_recipients", -- Safety Net Assistance FNP Maintenance of Effort (MOE) Recipients.
    "family_assistance_federally_participating_cases", -- Family Assistance cases funded with federal Temporary Assistance for Needy Families funds in whole or in part.
    "month", -- Month data pertains to.  Caseloads are reported on a monthly basis.  Day is always the first day of the reference month.  The first available month is January 2002.
    "month_code", -- Number of month.  January = 1, December = 12.
    "maintenance_of_effort_adults", -- Safety Net Assistance FNP Maintenance of Effort (MOE) Adults.
    "federally_non_participating_expenditures", -- Federally Non-Participating (FNP) Cases.  These are Safety Net Assistance FNP and Family Assistance FNP Expenditures.
    "safety_net_assistance_recipients", -- Safety Net Assistance Recipients.
    "safety_net_federally_non_participating_expenditures", -- Safety Net Assistance Federally Non-Participating and Family Assistance Federally Non-Participating Expenditures.
    "district_code", -- Number designating each of the State’s Local Social Services Districts. For the non-New York City counties, the numbers refer to the alphabetical order of the district name (e.g., Albany=01, Yates = 57).  New York City = 66.
    "safety_net_assistance_federally_participating_children", -- Safety Net Assistance FP Children.
    "safety_net_federally_non_participating_recipients", -- Safety Net Assistance Federally Non-Participating and Family Assistance Federally Non-Participating Recipients.
    "safety_net_assistance_children", -- Safety Net Assistance Children.
    "safety_net_assistance_cases", -- Safety Net Assistance Cases.
    "total_temporary_assistance_adults", -- Total Temporary Assistance Adults.
    "safety_net_assistance_expenditures", -- Safety Net Assistance Expenditures.
    "non_maintenance_of_effort_cases", -- Safety Net Assistance FNP Non-Maintenance of Effort Cases.
    "federally_participating_temporary_assistance_for_needy_fami_000", -- Federally Participating TANF (Family Assistance FP and Safety Net FP) Recipients.
    "maintenance_of_effort_cases", -- Safety Net Assistance FNP Maintenance of Effort (MOE) Cases.  MOE cases are cases exceeding the TANF time limit or qualified aliens in the USA less than 5 years.
    "year", -- Year data pertains to
    "district", -- Text name of each social services district.
    "federally_non_participating_recipients", -- Federally Non-Participating (FNP) Cases.  These are Safety Net Assistance FNP and Family Assistance FNP Recipients.
    "federally_non_participating_cases", -- Federally Non-Participating (FNP) Cases.  These are Safety Net Assistance FNP and Family Assistance FNP Cases.
    "total_temporary_assistance_cases", -- Total Temporary Assistance case count.  Sum of Family Assistance and Safety Net Assistance cases receiving ongoing assistance in the month.
    "safety_net_assistance_federally_participating_cases", -- Safety Net Assistance FP cases.  These are TANF cases in the non-cash portion of the Safety Net Program due to substance abuse on the part of a case member.
    "federally_participating_temporary_assistance_for_needy_fami_001", -- Federally Participating Temporary Assistance for Needy Families (TANF) Cases.  These are Family Assistance FP and Safety Net FP Cases.
    "maintenance_of_effort_children", -- Safety Net Assistance FNP Maintenance of Effort (MOE) Children.
    "safety_net_federally_non_participating_children", -- Safety Net Assistance Federally Non-Participating and Family Assistance Federally Non-Participating Children.
    "safety_net_assistance_federally_participating_recipients", -- Safety Net Assistance FP Recipients.
    "safety_net_federally_non_participating_adults", -- Safety Net Assistance Federally Non-Participating and Family Assistance Federally Non-Participating Adults.
    "federally_participating_temporary_assistance_for_needy_fami_002", -- Federally Participating TANF (Family Assistance FP and Safety Net FP) Expenditures.
    "family_assistance_federally_participating_expenditures", -- Family Assistance FP Expenditures.
    "safety_net_assistance_adults", -- Safety Net Assistance Adults.
    "maintenance_of_effort_expenditures", -- Safety Net Assistance FNP Maintenance of Effort (MOE) Expenditures.
    "non_maintenance_of_effort_adults", -- Safety Net Assistance FNP Non-Maintenance of Effort Adults.
    "family_assistance_federally_participating_recipients", -- Family Assistance FP Recipients.
    "safety_net_assistance_federally_participating_adults" -- Safety Net Assistance FP Adults.
FROM
    "ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6:latest"."public_assistance_pa_caseloads_and_expenditures"
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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6 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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6: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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6

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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6:latest

This will download all the objects for the latest tag of ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6 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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6: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 ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6: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, ny-gov/public-assistance-pa-caseloads-and-expenditures-42wv-qbv6 is just another Postgres schema.

Related Documentation:

Loading...