usaid-gov/baseline-study-of-food-for-peace-title-ii-uby3-zt62
Icon for Socrata external plugin

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

"usaid-gov/baseline-study-of-food-for-peace-title-ii-uby3-zt62:latest"."baseline_study_of_food_for_peace_title_ii"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "h103u_037", -- Drinks at restaurants How much did you eat in the past 7 days Unit
    "h604_11", -- Motor cycles what is the age
    "h605_10", -- Bicycles value in Shilling UGX
    "h607_07", -- Radio cassette how much did you pay in the past 12 months
    "h605_07", -- Radio cassette value in Shilling UGX
    "h607_05", -- Household appliances how much did you pay in the past 12 months
    "h605_05", -- Household appliances value in Shilling UGX
    "h604_05", -- Household appliances what is the age
    "h605_04", -- Furniture Furnishings value in Shilling UGX
    "h604_04", -- Furniture Furnishings what is the age
    "h603_04", -- Furniture Furnishings how many do you own
    "h604_03", -- Land what is the age
    "h603_03", -- Land how many do you own
    "h602_03", -- Land do you own
    "h607_02", -- Other buildings how much did you pay in the past 12 months
    "h605_02", -- Other buildings value in Shilling UGX
    "h604_02", -- Other buildings what is the age
    "h405a", -- H105a How much do you pay to rent this house
    "h403", -- H103 How many years ago was this house built how old is it
    "h402", -- H102 If you sold this house today how much would you receive for it
    "h303_039", -- How much did they cost Shilling UGX
    "h303_037", -- How much did they cost Shilling UGX
    "h301_037", -- 809 CODE for dowry and or debt payments
    "h302_036", -- Did you consume any in the past 12 months
    "h303_035", -- How much did they cost Shilling UGX
    "h301_035", -- 807 CODE for funerals and other social functions
    "h303_033", -- How much did they cost Shilling UGX
    "h303_032", -- How much did they cost Shilling UGX
    "h303_027", -- How much did they cost Shilling UGX
    "h303_022", -- How much did they cost Shilling UGX
    "h303_021", -- How much did they cost Shilling UGX
    "h303_020", -- How much did they cost Shilling UGX
    "h303_017", -- How much did they cost Shilling UGX
    "h301_017", -- 408 CODE for security protection
    "h302_016", -- Did you consume any in the past 12 months
    "h303_014", -- How much did they cost Shilling UGX
    "h303_012", -- How much did they cost Shilling UGX
    "h303_010", -- How much did they cost Shilling UGX
    "h303_008", -- How much did they cost Shilling UGX
    "h303_006", -- How much did they cost Shilling UGX
    "h303_005", -- How much did they cost Shilling UGX
    "h303_003", -- How much did they cost Shilling UGX
    "h303_001", -- How much did they cost Shilling UGX
    "h203_033", -- How much did they cost Shilling UGX
    "h203_032", -- How much did they cost Shilling UGX
    "h203_031", -- How much did they cost Shilling UGX
    "h203_030", -- How much did they cost Shilling UGX
    "h201_029", -- 602 CODE for dry cleaining and laundry
    "h203_026", -- How much did they cost Shilling UGX
    "h203_020", -- How much did they cost Shilling UGX
    "h203_019", -- How much did they cost Shilling UGX
    "h203_018", -- How much did they cost Shilling UGX
    "h201_017", -- 460 CODE for other non durable and personal goods
    "h202_016", -- Did you consume any in the past one month
    "h201_013", -- 456 CODE for handbags travel bags etc
    "h203_012", -- How much did they cost Shilling UGX
    "h203_010", -- How much did they cost Shilling UGX
    "h203_009", -- How much did they cost Shilling UGX
    "h201_009", -- 451 CODE for matches
    "h203_001", -- How much did they cost Shilling UGX
    "h106u_040", -- Other food not listed How much came from your own production Unit
    "h107q_038", -- Other food not listed How much came from gifts other sources Quantity
    "h103q_038", -- Other food not listed How much did you eat in the past 7 days Quantity
    "h102_038", -- Other food not listed Did you eat any in the past 7 days
    "h102_037", -- Drinks at restaurants Did you eat any in the past 7 days
    "h103u_036", -- Food at restaurants How much did you eat in the past 7 days Unit
    "h105_035", -- Other tobacco How much did you spend Shilling UGX
    "h201_005", -- 308 CODE for Paraffin kerosene
    "h105_039", -- Other food not listed How much did you spend Shilling UGX
    "h106u_036", -- Food at restaurants How much came from your own production Unit
    "h303_038", -- How much did they cost Shilling UGX
    "h201_032", -- 605 CODE for expenses in hotels lodging etc
    "h303_009", -- How much did they cost Shilling UGX
    "h106q_037", -- Drinks at restaurants How much came from your own production Quantity
    "h301_001", -- 201 CODE for clothing mens womens childrens
    "h201_018", -- 461 CODE for tires tubes spares etc
    "h301_008", -- 303 CODE for curtains bedsheets mattress blankets etc
    "h602_02", -- Other buildings do you own
    "h201_003", -- 306 CODE for Electricity
    "h302_032", -- Did you consume any in the past 12 months
    "h606_03", -- Land did you purchase in the past 12 months
    "h603_08", -- Generators how many do you own
    "h301_013", -- 404 CODE for radio
    "h302_018", -- Did you consume any in the past 12 months
    "h301_039", -- 811a Other annual non consumption expenditures what
    "h102_036", -- Food at restaurants Did you eat any in the past 7 days
    "h301_010", -- 401 CODE for charcoal and kerosene stoves
    "h106q_038", -- Other food not listed How much came from your own production Quantity
    "h302_035", -- Did you consume any in the past 12 months
    "h106q_036", -- Food at restaurants How much came from your own production Quantity
    "h301_038", -- 810 CODE for animal sales letter market fee
    "h303_036", -- How much did they cost Shilling UGX
    "h301_015", -- 406 CODE for phone handsets
    "h602_07", -- Radio cassette do you own
    "h302_008", -- Did you consume any in the past 12 months
    "h302_013", -- Did you consume any in the past 12 months
    "h107u_036", -- Food at restaurants How much came from gifts other sources Unit
    "h302_005", -- Did you consume any in the past 12 months
    "h301_014", -- 405 CODE for computers for household use
    "h303_018", -- How much did they cost Shilling UGX
    "h203_002", -- How much did they cost Shilling UGX
    "h303_023", -- How much did they cost Shilling UGX
    "h107u_038", -- Other food not listed How much came from gifts other sources Unit
    "h202_003", -- Did you consume any in the past one month
    "h404b_4", -- H104b Rental payment time period Year
    "h104u_040", -- Other food not listed How much came from purchases Unit
    "h302_030", -- Did you consume any in the past 12 months
    "h606_08", -- Generators did you purchase in the past 12 months
    "h603_05", -- Household appliances how many do you own
    "h201_021", -- 466 CODE for stamps envelopes
    "h202_029", -- Did you consume any in the past one month
    "h302_010", -- Did you consume any in the past 12 months
    "h301_024", -- 601 CODE for educational fees PTA boarding uniforms books supplies
    "h302_001", -- Did you consume any in the past 12 months
    "h303_002", -- How much did they cost Shilling UGX
    "h601_04", -- CODE Furniture Furnishings
    "h105_036", -- Food at restaurants How much did you spend Shilling UGX
    "h201_031", -- 604 CODE for barber and beauty shops
    "h201_033", -- 606a Other monthly expenditures what
    "h203_016", -- How much did they cost Shilling UGX
    "h607_08", -- Generators how much did you pay in the past 12 months
    "h301_027", -- 702 CODE for expenditures on agricultural services
    "h202_032", -- Did you consume any in the past one month
    "h303_019", -- How much did they cost Shilling UGX
    "h102_039", -- Other food not listed Did you eat any in the past 7 days
    "h107u_040", -- Other food not listed How much came from gifts other sources Unit
    "h303_011", -- How much did they cost Shilling UGX
    "h301_028", -- 703 CODE for other services NES
    "h601_08", -- CODE Generators
    "h202_011", -- Did you consume any in the past one month
    "h202_018", -- Did you consume any in the past one month
    "h301_030", -- 802 CODE for property rates taxes
    "h301_009", -- 304 CODE for other furnishings and repairs
    "h605_03", -- Land value in Shilling UGX
    "h103q_039", -- Other food not listed How much did you eat in the past 7 days Quantity
    "h201_026", -- 501 CODE for health and medical care services
    "h104u_038", -- Other food not listed How much came from purchases Unit
    "h201_015", -- 458 CODE for newspapers and magazines
    "h103u_039", -- Other food not listed How much did you eat in the past 7 days Unit
    "h202_015", -- Did you consume any in the past one month
    "h202_001", -- Did you consume any in the past one month
    "h203_024", -- How much did they cost Shilling UGX
    "h102_040", -- Other food not listed Did you eat any in the past 7 days
    "h301_002", -- 202 CODE for other clothing and clothing materials
    "h302_034", -- Did you consume any in the past 12 months
    "h203_003", -- How much did they cost Shilling UGX
    "h301_026", -- 701 CODE for expenditures on household services
    "h302_024", -- Did you consume any in the past 12 months
    "h603_02", -- Other buildings how many do you own
    "h602_06", -- Television do you own
    "h302_002", -- Did you consume any in the past 12 months
    "h604_06", -- Television what is the age
    "h604_07", -- Radio cassette what is the age
    "h603_07", -- Radio cassette how many do you own
    "h203_014", -- How much did they cost Shilling UGX
    "h203_027", -- How much did they cost Shilling UGX
    "h301_025", -- 602 CODE for other educational expenses
    "h302_011", -- Did you consume any in the past 12 months
    "h302_031", -- Did you consume any in the past 12 months
    "h302_023", -- Did you consume any in the past 12 months
    "h601_07", -- CODE Radio cassette
    "h201_020", -- 463 CODE for transport fares taxi bus boda boda
    "h604_10", -- Bicycles what is the age
    "h202_004", -- Did you consume any in the past one month
    "h202_013", -- Did you consume any in the past one month
    "h301_007", -- 302 CODE for carpets mats etc
    "h607_10", -- Bicycles how much did you pay in the past 12 months
    "h301_023", -- 506 CODE for other glass tableware utensils and repairs
    "h606_04", -- Furniture Furnishings did you purchase in the past 12 months
    "h303_030", -- How much did they cost Shilling UGX
    "h606_10", -- Bicycles did you purchase in the past 12 months
    "h302_007", -- Did you consume any in the past 12 months
    "h301_011", -- 402 CODE for electronic appliances or equipment
    "h301_019", -- 410 CODE for jewelry watches etc
    "h404b_3", -- H104b Rental payment time period MONTH
    "h302_014", -- Did you consume any in the past 12 months
    "h106u_038", -- Other food not listed How much came from your own production Unit
    "h302_038", -- Did you consume any in the past 12 months
    "h105_037", -- Drinks at restaurants How much did you spend Shilling UGX
    "h605_08", -- Generators value in Shilling UGX
    "h302_022", -- Did you consume any in the past 12 months
    "h601_05", -- CODE Household appliances
    "h202_033", -- Did you consume any in the past one month
    "h202_026", -- Did you consume any in the past one month
    "h202_022", -- Did you consume any in the past one month
    "h607_04", -- Furniture Furnishings how much did you pay in the past 12 months
    "h602_09", -- Solar panel electric inverters do you own
    "h201_016", -- 459 CODE for security protection
    "h602_10", -- Bicycles do you own
    "h103q_040", -- Other food not listed How much did you eat in the past 7 days Quantity
    "h301_020", -- 501 CODE for plastics
    "h202_010", -- Did you consume any in the past one month
    "h301_031", -- 803 CODE for user fees and charges
    "h405b_3", -- H105b Rental payment time period MONTH
    "h202_031", -- Did you consume any in the past one month
    "h603_10", -- Bicycles how many do you own
    "h606_05", -- Household appliances did you purchase in the past 12 months
    "h301_029", -- 801 CODE for taxes income local services etc
    "h107q_035", -- Other tobacco How much came from gifts other sources Quantity
    "h106q_039", -- Other food not listed How much came from your own production Quantity
    "h301_036", -- 808 CODE for interest on loans
    "h301_012", -- 403 CODE for transport equipment bicycles motor cycles motors etc
    "h202_023", -- Did you consume any in the past one month
    "h405b_4", -- H105b Rental payment time period YEAR
    "h303_028", -- How much did they cost Shilling UGX
    "h202_027", -- Did you consume any in the past one month
    "h602_11", -- Motor cycles do you own
    "h301_005", -- 205 CODE for other footwear and repairs
    "h201_010", -- 452 CODE for soap
    "h601_03", -- CODE Land
    "h302_006", -- Did you consume any in the past 12 months
    "h107u_039", -- Other food not listed How much came from gifts other sources Unit
    "h606_06", -- Television did you purchase in the past 12 months
    "h303_015", -- How much did they cost Shilling UGX
    "h302_019", -- Did you consume any in the past 12 months
    "h202_017", -- Did you consume any in the past one month
    "id",
    "h606_02", -- Other buildings did you purchase in the past 12 months
    "h201_012", -- 455 CODE for cosmetics
    "h404b_1", -- H104b Rental payment time period DAY
    "h302_009", -- Did you consume any in the past 12 months
    "h607_03", -- Land how much did you pay in the past 12 months
    "h107u_037", -- Drinks at restaurants How much came from gifts other sources Unit
    "h601_10", -- CODE Bicycles
    "h104q_037", -- Drinks at restaurants How much came from purchases Quanity
    "h301_021", -- 504 CODE for enamel and metallic utensils
    "h607_09", -- Solar panel electric inverters how much did you pay in the past 12 months
    "h301_018", -- 409 CODE for other equipment and repairs
    "h104u_036", -- Food at restaurants How much came from purchases Unit
    "h107q_037", -- Drinks at restaurants How much came from gifts other sources Quantity
    "h302_021", -- Did you consume any in the past 12 months
    "h301_034", -- 806 CODE for remittances gifts and other transfers
    "h404a", -- H104a If your rented this house today how much rent would you receive
    "h202_028", -- Did you consume any in the past one month
    "h200", -- Line Number from household roster
    "h602_08", -- Generators do you own
    "h302_028", -- Did you consume any in the past 12 months
    "h303_031", -- How much did they cost Shilling UGX
    "h601_06", -- CODE Television
    "h302_015", -- Did you consume any in the past 12 months
    "h202_012", -- Did you consume any in the past one month
    "h106u_035", -- Other tobacco How much came from your own production Unit
    "h603_11", -- Motor cycles how many do you own
    "h303_026", -- How much did they cost Shilling UGX
    "h302_004", -- Did you consume any in the past 12 months
    "h103q_037", -- Drinks at restaurants How much did you eat in the past 7 days Quantity
    "h201_004", -- 307 CODE for Generators lawn mower fuels
    "h302_025", -- Did you consume any in the past 12 months
    "h302_017", -- Did you consume any in the past 12 months
    "h302_039", -- Did you consume any in the past 12 months
    "h303_007", -- How much did they cost Shilling UGX
    "h601_09", -- CODE Solar panel electric inverters
    "h202_014", -- Did you consume any in the past one month
    "h202_007", -- Did you consume any in the past one month
    "h202_008", -- Did you consume any in the past one month
    "h301_033", -- 805 CODE for insurance premiums
    "h201_008", -- 311 CODE for Other utilities power expenses
    "h103u_038", -- Other food not listed How much did you eat in the past 7 days Unit
    "h203_015", -- How much did they cost Shilling UGX
    "h105_040", -- Other food not listed How much did you spend Shilling UGX
    "h602_05", -- Household appliances do you own
    "h202_019", -- Did you consume any in the past one month
    "h605_09", -- Solar panel electric inverters value in Shilling UGX
    "h302_026", -- Did you consume any in the past 12 months
    "h104q_039", -- Other food not listed How much came from purchases Quanity
    "h104u_035", -- Other tobacco How much came from purchases Unit
    "h604_09", -- Solar panel electric inverters what is the age
    "h203_022", -- How much did they cost Shilling UGX
    "h202_005", -- Did you consume any in the past one month
    "h605_06", -- Television value in Shilling UGX
    "h606_07", -- Radio cassette did you purchase in the past 12 months
    "h601_11", -- CODE Motor cycles
    "h203_004", -- How much did they cost Shilling UGX
    "h303_004", -- How much did they cost Shilling UGX
    "h302_029", -- Did you consume any in the past 12 months
    "h203_008", -- How much did they cost Shilling UGX
    "h107q_039", -- Other food not listed How much came from gifts other sources Quantity
    "h203_007", -- How much did they cost Shilling UGX
    "h203_013", -- How much did they cost Shilling UGX
    "h302_027", -- Did you consume any in the past 12 months
    "h405b_2", -- H105b Rental payment time period WEEK
    "h302_033", -- Did you consume any in the past 12 months
    "h106u_039", -- Other food not listed How much came from your own production Unit
    "h104q_040", -- Other food not listed How much came from purchases Quanity
    "h303_024", -- How much did they cost Shilling UGX
    "h303_025", -- How much did they cost Shilling UGX
    "h103u_040", -- Other food not listed How much did you eat in the past 7 days Unit
    "h107q_040", -- Other food not listed How much came from gifts other sources Quantity
    "h301_003", -- 203 CODE for tailoring and materials
    "h203_006", -- How much did they cost Shilling UGX
    "h301_016", -- 407 CODE for agricultural tools
    "h106u_037", -- Drinks at restaurants How much came from your own production Unit
    "h203_023", -- How much did they cost Shilling UGX
    "h303_013", -- How much did they cost Shilling UGX
    "h104q_036", -- Food at restaurants How much came from purchases Quanity
    "h201_011", -- 454 CODE for toothpaste
    "h603_06", -- Television how many do you own
    "h601_02", -- CODE Other buildings
    "h302_020", -- Did you consume any in the past 12 months
    "h302_003", -- Did you consume any in the past 12 months
    "h302_037", -- Did you consume any in the past 12 months
    "h607_06", -- Television how much did you pay in the past 12 months
    "h201_024", -- 471a Other transport communication expenses what
    "h201_028", -- 601 CODE for sports theaters etc
    "h401", -- H101 What is ownership status of house
    "h201_002", -- 305 CODE for Water
    "h201_023", -- 469 CODE for mobile money fees
    "h404b_2", -- H104b Rental payment time period WEEK
    "h303_029", -- How much did they cost Shilling UGX
    "h302_012", -- Did you consume any in the past 12 months
    "h203_005", -- How much did they cost Shilling UGX
    "h106q_035", -- Other tobacco How much came from your own production Quantity
    "h301_004", -- 204 CODE for footwear
    "h201_022", -- 467 CODE for phone fees
    "h604_08", -- Generators what is the age
    "h201_014", -- 457 CODE for batteries
    "h104u_037", -- Drinks at restaurants How much came from purchases Unit
    "h203_029", -- How much did they cost Shilling UGX
    "h201_030", -- 603 CODE for houseboys girls etc
    "h201_027", -- 502 CODE for medicines etc
    "h202_009", -- Did you consume any in the past one month
    "h202_024", -- Did you consume any in the past one month
    "h202_020", -- Did you consume any in the past one month
    "h103q_036", -- Food at restaurants How much did you eat in the past 7 days Quantity
    "h106q_040", -- Other food not listed How much came from your own production Quantity
    "h104u_039", -- Other food not listed How much came from purchases Unit
    "h606_09", -- Solar panel electric inverters did you purchase in the past 12 months
    "h107u_035", -- Other tobacco How much came from gifts other sources Unit
    "h203_017", -- How much did they cost Shilling UGX
    "h202_030", -- Did you consume any in the past one month
    "h602_04", -- Furniture Furnishings do you own
    "h107q_036", -- Food at restaurants How much came from gifts other sources Quantity
    "h301_032", -- 804 CODE for pension and social security payments
    "h202_002", -- Did you consume any in the past one month
    "h104q_038", -- Other food not listed How much came from purchases Quanity
    "h201_001", -- 304 CODE for Maintenance and repair expenses
    "h203_021", -- How much did they cost Shilling UGX
    "h405b_1", -- H105b Rental payment time period DAY
    "h303_034", -- How much did they cost Shilling UGX
    "h201_007", -- 310 CODE for Firewood
    "h301_022", -- 505 CODE for switches plugs cables etc
    "h303_016", -- How much did they cost Shilling UGX
    "h603_09", -- Solar panel electric inverters how many do you own
    "h201_019", -- 462 CODE for petrol diesel etc
    "h202_006", -- Did you consume any in the past one month
    "h201_006", -- 309 CODE for Charcoal
    "h203_011", -- How much did they cost Shilling UGX
    "h301_006", -- 301 CODE for furniture items
    "h203_028", -- How much did they cost Shilling UGX
    "h105_038", -- Other food not listed How much did you spend Shilling UGX
    "h202_021" -- Did you consume any in the past one month
FROM
    "usaid-gov/baseline-study-of-food-for-peace-title-ii-uby3-zt62:latest"."baseline_study_of_food_for_peace_title_ii"
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/baseline-study-of-food-for-peace-title-ii-uby3-zt62 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/baseline-study-of-food-for-peace-title-ii-uby3-zt62: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/baseline-study-of-food-for-peace-title-ii-uby3-zt62" \
  --handler-options '{
    "domain": "data.usaid.gov",
    "tables": {
        "baseline_study_of_food_for_peace_title_ii": "uby3-zt62"
    }
}'

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/baseline-study-of-food-for-peace-title-ii-uby3-zt62 is just another Postgres schema.

Related Documentation: