usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy

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

"usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy:latest"."feed_the_future_mozambique_baseline_population"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "d07", -- ZID_Electr_yn
    "e07_i",
    "c01a_d", -- g3.1a.d Anyone Owns Chicken
    "c09_b", -- g3.06b. Decide to buy new Large Livestock
    "c09_l", -- g3.06l. Decide to buy new Cell Phone
    "c05_g", -- g3.04g. Decide to give away Farm Equip - mech
    "c02_a", -- g3.02a. Owns most of Agriculture
    "g05_d",
    "b03_5", -- g2.03e Input for spend money from Wage and salary employment
    "c10_a", -- g3.07a. Taken any loans from NGO
    "c01a_g", -- g3.1a.g Anyone Owns Farm Equip - mech
    "b02_5", -- g2.02e Input for Wage and salary employment
    "c01b_m", -- g3.1b.m Household owns Other Land
    "d08", -- ZID_Fuel_src
    "c06_i", -- g3.05i. Decide to rent out House
    "b03_2", -- g2.03b Input for spend money from Cash crop farming
    "f04", -- ZIF_Sleep_hungry_freq
    "zi_start_dt",
    "g01_i",
    "f01", -- ZIF_No_food_yn
    "provname",
    "c11_e", -- g3.08e. Decide to borrow from Group
    "c01b_f", -- g3.1b.f Household owns Farm Equip - non mech
    "g02_d",
    "g05_c",
    "c02_d", -- g3.02d. Owns most of Chicken
    "c04_g", -- g3.03g. Decide to sell Farm Equip - mech
    "c10_d", -- g3.07d. Taken any loans from Friends
    "c01a_c", -- g3.1a.c Anyone Owns Small Livestock
    "a04", -- Primary Secondary
    "g01_c",
    "c01b_i", -- g3.1b.i Household owns House
    "raiprod_any", -- Inadequacy in autonomy in production
    "c04_j", -- g3.03j. Decide to sell Large Durable
    "g404_b",
    "he",
    "c05_i", -- g3.04i. Decide to give away House
    "e07_j",
    "c06_a", -- g3.05a. Decide to rent out Agriculture
    "ci_above_20p", -- Individual indicator that woman lacks gender parity
    "b02_1", -- g2.02a Input for Food crop farming
    "c01a_a", -- g3.1a.a Anyone Owns Agriculture
    "c01b_a", -- g3.1b.a Household owns Agriculture
    "c01b_l", -- g3.1b.l Household owns Cell Phone
    "g404_j",
    "c09_i", -- g3.06i. Decide to buy new House
    "c05_h", -- g3.04h. Decide to give away Nonfarm Equip
    "c09_e", -- g3.06e. Decide to buy new Fish Pond
    "aa",
    "zia_region_cd",
    "c10_c", -- g3.07c. Taken any loans from Formal lender
    "c09_h", -- g3.06h. Decide to buy new Nonfarm Equip
    "c09_j", -- g3.06j. Decide to buy new Large Durable
    "g404_d",
    "c04_f", -- g3.03f. Decide to sell Farm Equip - non mech
    "c01a_j", -- g3.1a.j Anyone Owns Large Durable
    "g404_g",
    "c05_m", -- g3.04m. Decide to give away Other Land
    "a05", -- ZIG1_Sex_g1
    "c04_i", -- g3.03i. Decide to sell House
    "d05", -- ZID_Toilet_tp
    "credjanydec_any", -- Inadequacy in access to and decisions on credit
    "g01_e",
    "c09_m", -- g3.06m. Decide to buy new Other Land
    "a06", -- ZIA_Household Type
    "g03_e",
    "incdec_count", -- Inadequacy in control over use of income
    "c02_e", -- g3.02e. Owns most of Fish Pond
    "zia_location_cd",
    "c04_h", -- g3.03h. Decide to sell Nonfarm Equip
    "id_code", -- ZIG1_Respondent_id
    "c09_k", -- g3.06k. Decide to buy new Small Durable
    "npoor_z105", -- Inadequacy in workload
    "zia_supervisor_cd",
    "e07_f",
    "d11", -- ZID_Fuel_src_2
    "c11_c", -- g3.08c. Decide to borrow from Formal lender
    "c01a_f", -- g3.1a.f Anyone Owns Farm Equip - non mech
    "b03_3", -- g2.03c Input for spend money from Livestock raising
    "g02_h",
    "g04_c",
    "c06_l", -- g3.05l. Decide to rent out Cell Phone
    "c06_n", -- g3.05n. Decide to rent out Transportation
    "zia_int_outcome",
    "c02_j", -- g3.02j. Owns most of Large Durable
    "c04_l", -- g3.03l. Decide to sell Cell Phone
    "leisuretime", -- Inadequacy in leisure
    "e07_k",
    "e07_b",
    "c12_c", -- g3.09c. Decide how to use money from Formal lender
    "d04", -- ZID_Rooms_num
    "e02_a", -- g4.01 Speak in public to help decide
    "c02_i", -- g3.02i. Owns most of House
    "urbrur", -- Urban Rural - 1:urban; 2:rural
    "c04_n", -- g3.03n. Decide to sell Transportation
    "c05_j", -- g3.04j. Decide to give away Large Durable
    "c06_j", -- g3.05j. Decide to rent out Large Durable
    "b03_4", -- g2.03d Input for spend money from Non-farm
    "b02_4", -- g2.02d Input for Non-farm
    "c01a_m", -- g3.1a.m Anyone Owns Other Land
    "c05_k", -- g3.04k. Decide to give away Small Durable
    "c05_b", -- g3.04b. Decide to give away Large Livestock
    "e02_c", -- g4.03 Speak in public to protest
    "speakpublic_any", -- Inadequacy in speaking in public
    "c04_k", -- g3.03k. Decide to sell Small Durable
    "c09_c", -- g3.06c. Decide to buy new Small Livestock
    "g02_g",
    "c06_m", -- g3.05m. Decide to rent out Other Land
    "wt_weai_1", -- WEAI weight for Males
    "c09_d", -- g3.06d. Decide to buy new Chicken
    "g01_h",
    "c12_e", -- g3.09e. Decide how to use money from Group
    "ea_20p",
    "g404_k",
    "d09", -- ZID_Drink_water_src_2
    "c12_d", -- g3.09d. Decide how to use money from Friends
    "ci_gap_20p", -- Individual empowerment gap for women without parity
    "c05_a", -- g3.04a. Decide to give away Agriculture
    "weaiwght", -- WEAI gender specific weight
    "c11_d", -- g3.08d. Decide to borrow from Friends
    "f03", -- ZIF_Sleep_hungry_yn
    "feelinputdecagr", -- Inadequacy in input in productive decisions
    "modd_missing",
    "g04_d",
    "b02_2", -- g2.02b Input for Cash crop farming
    "b01_5", -- g2.01e Participate in Wage and salary employment
    "c10_b", -- g3.07b. Taken any loans from Informal lender
    "d01", -- ZID_Roof_tp
    "groupmember_any", -- Inadequacy in group member
    "country",
    "c01a_h", -- g3.1a.h Anyone Owns Nonfarm Equip
    "g02_e",
    "rp",
    "jown_count", -- Inadequacy in ownership of assets
    "c04_b", -- g3.03b. Decide to sell Large Livestock
    "c01b_n", -- g3.1b.n Household owns Transportation
    "c06_c", -- g3.05c. Decide to rent out Small Livestock
    "c01b_b", -- g3.1b.b Household owns Large Livestock
    "c09_n", -- g3.06n. Decide to buy new Transportation
    "g404_h",
    "ch_20p", -- Condition of disempowerment k
    "c01b_k", -- g3.1b.k Household owns Small Durable
    "g05_b",
    "d03", -- ZID_Ext_wall_tp
    "c04_d", -- g3.03d. Decide to sell Chicken
    "c01b_j", -- g3.1b.j Household owns Large Durable
    "gpi",
    "b02_3", -- g2.02c Input for Livestock raising
    "g04_b",
    "e02_b", -- g4.02 Speak in public to ensure proper wages
    "e07_e",
    "c04_e", -- g3.03e. Decide to sell Fish Pond
    "c05_c", -- g3.04c. Decide to give away Small Livestock
    "c01b_h", -- g3.1b.h Household owns Nonfarm Equip
    "c06_h", -- g3.05h. Decide to rent out Nonfarm Equip
    "d10", -- ZID_Electr_yn_2
    "c05_e", -- g3.04e. Decide to give away Fish Pond
    "c05_l", -- g3.04l. Decide to give away Cell Phone
    "g05_e",
    "e07_h",
    "d02", -- ZID_Floor_tp
    "c12_b", -- g3.09b. Decide how to use money from Informal lender
    "g01_g",
    "d06", -- ZID_Drink_water_src
    "c01a_b", -- g3.1a.b Anyone Owns Large Livestock
    "c01b_c", -- g3.1b.c Household owns Small Livestock
    "c06_g", -- g3.05g. Decide to rent out Farm Equip - mech
    "c02_n", -- g3.02n. Owns most of Transportation
    "ci", -- Individual disempowerment score
    "g01_b",
    "pbs_id",
    "c09_f", -- g3.06f. Decide to buy new Farm Equip - non mech
    "g03_c",
    "c01a_n", -- g3.1a.n Anyone Owns Transportation
    "b01_6", -- g2.01f Participate in Fishing or fishpond culture
    "g01_d",
    "e07_c",
    "g02_c",
    "c01b_g", -- g3.1b.g Household owns Farm Equip - mech
    "g02_b",
    "a12", -- ZIG1_Int_alone
    "b01_4", -- g2.01d Participate in Non-farm
    "modf_missing",
    "zia_visit2_dt",
    "f05", -- ZIF_Whl_day_no_eat_yn
    "g404_a",
    "c04_m", -- g3.03m. Decide to sell Other Land
    "e07_d",
    "c06_f", -- g3.05f. Decide to rent out Farm Equip - non mech
    "g404_c",
    "c01a_i", -- g3.1a.i Anyone Owns House
    "c06_e", -- g3.05e. Decide to rent out Fish Pond
    "g404_f",
    "c09_a", -- g3.06a. Decide to buy new Agriculture
    "hp",
    "c02_g", -- g3.02g. Owns most of Farm Equip - mech
    "c01a_l", -- g3.1a.l Anyone Owns Cell Phone
    "g04_e",
    "c01b_e", -- g3.1b.e Household owns Fish Pond
    "c02_c", -- g3.02c. Owns most of Small Livestock
    "c05_f", -- g3.04f. Decide to give away Farm Equip - non mech
    "g404_e",
    "b01_2", -- g2.01b Participate in Cash crop farming
    "e07_g",
    "zia_district_cd",
    "zia_cluster_cd",
    "g03_b",
    "g404_i",
    "c05_n", -- g3.04n. Decide to give away Transportation
    "c06_d", -- g3.05d. Decide to rent out Chicken
    "c05_d", -- g3.04d. Decide to give away Chicken
    "zia_visit2_yn",
    "c04_c", -- g3.03c. Decide to sell Small Livestock
    "wt_weai_2", -- WEAI weight for Females
    "c11_a", -- g3.08a. Decide to borrow from NGO
    "f06", -- ZIF_Whl_day_no_eat_freq
    "c02_f", -- g3.02f. Owns most of Farm Equip - non mech
    "b01_3", -- g2.01c Participate in Livestock raising
    "c11_b", -- g3.08b. Decide to borrow from Informal lender
    "g03_d",
    "c12_a", -- g3.09a. Decide how to use money from NGO
    "g02_i",
    "b01_1", -- g2.01a Participate in Food crop farming
    "c06_k", -- g3.05k. Decide to rent out Small Durable
    "districname",
    "jrightanyagr", -- Inadequacy in purchase,sale, or transfer of assets
    "c02_l", -- g3.02l. Owns most of Cell Phone
    "c02_m", -- g3.02m. Owns most of Other Land
    "c01b_d", -- g3.1b.d Household owns Chicken
    "c02_k", -- g3.02k. Owns most of Small Durable
    "c09_g", -- g3.06g. Decide to buy new Farm Equip - mech
    "c02_h", -- g3.02h. Owns most of Nonfarm Equip
    "b03_6", -- g2.03f Input for spend money from Fishing or fishpond culture
    "f04b", -- g6.02 How satisfied, scale of 1-10
    "b02_6", -- g2.02f Input for Fishing or fishpond culture
    "b03_1", -- g2.03a Input for spend money from Food crop farming
    "e07_a",
    "c06_b", -- g3.05b. Decide to rent out Large Livestock
    "c02_b", -- g3.02b. Owns most of Large Livestock
    "c01a_k", -- g3.1a.k Anyone Owns Small Durable
    "c04_a", -- g3.03a. Decide to sell Agriculture
    "c10_e", -- g3.07e. Taken any loans from Group
    "f02", -- ZIF_No_food_freq
    "c01a_e" -- g3.1a.e Anyone Owns Fish Pond
FROM
    "usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy:latest"."feed_the_future_mozambique_baseline_population"
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 usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.usaid.gov. When you queryusaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy: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)"
 

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.usaid.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 \
  "usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy" \
  --handler-options '{
    "domain": "data.usaid.gov",
    "tables": {
        "feed_the_future_mozambique_baseline_population": "7dr5-x8hy"
    }
}'

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, usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy is just another Postgres schema.

Related Documentation: