finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj

  • credits
  • grants
  • ibrd/ida summaries
  • ida
  • projects

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

"finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj:latest"."ida_statement_of_credits_and_grants_latest"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "closed_date_most_recent_", -- The date specified in the legal agreement (or extension) after which the Bank may, by notice to the borrower, terminate the right to make withdrawals from the loan account. 
    "effective_date_most_recent_", -- The date on which a legal agreement becomes effective, or is expected to become effective.
    "agreement_signing_date", -- The date the borrower and the Bank sign the loan agreement.
    "sold_3rd_party", -- Portion of loan sold to a third party.
    "undisbursed_amount", -- The amount of a loan commitment that is still available to be drawn down. These currency amounts have been converted to US dollars  at the exchange rates applicable at the end of period date. 
    "credit_number", -- For IBRD loans and IDA credits or grants a loan number consists of the organization prefix (IBRD/IDA) and a five-character label that uniquely identifies the loan within the organization.  In IDA, all grant labels start with the letter ‘H’ or 'D'.
    "first_repayment_date", -- The date on which principal repayment starts.
    "original_principal_amount", -- The original US dollar amount of the loan that is committed and approved.   
    "project_id", -- A Bank project is referenced by a project ID (Pxxxxxxx).  More than one loan, credit, or grant may be associated with one Project ID. 
    "region", -- Country lending is grouped into regions based on the current World Bank administrative (rather than geographic) region where project implementation takes place. The Other Region is used for loans to the IFC.
    "last_disbursement_date", -- The date on which the last disbursement was made (prior to the end of period date).
    "credits_held", -- The sum of the disbursed and outstanding amounts (net of repayments, i.e.  Due to IBRD/IDA) plus undisbursed available amounts expressed in historical US Dollars. 
    "borrower_s_obligation", -- The Borrower Obligation is the outstanding balance for the loan as of the end of period date in US dollars equivalent.   The Borrower's Obligation includes the amounts outstanding Due to 3rd parties.  
    "repaid_to_ida", -- Total principal amounts  paid or prepaid to IDA in US dollars, calculated at the exchange rate on the value date of the individual repayments.Repaid to IDA amounts include amounts written off under the Multilateral Debt Relief Initiative (MDRI).
    "disbursed_amount", -- The amount that has been disbursed from a loan commitment in equivalent US dollars calculated at the exchange rate on the value date of the individual disbursements.
    "borrower", -- The representative of the borrower to which the Bank loan is made. 
    "country", -- Country to which loan has been issued. Loans to the IFC are included under the country “World”.
    "board_approval_date", -- The date the World Bank approves the loan. 
    "credit_status", -- Status of the loan.See Data Dictionary attached in the About section or Data Dictionary dataset available from the list of all datasets for status descriptions. 
    "repaid_3rd_party", -- Amount repaid to a third party.
    "exchange_adjustment", -- The increase (decrease) in value of disbursed and outstanding amount due to exchange rate fluctuations; includes exchange adjustments on the amounts Due to 3rd parties.
    "due_to_ida", -- The amount due and outstanding as of the End of Period date.
    "service_charge_rate", -- Current Interest rate or service charge applied to loan.  For loans that could have more than one interest rate (e.g. FSL or SCL fixed rate loans), the interest rate is shown as “0”. 
    "country_code", -- Country Code according to the World Bank country list. Might be different from the ISO country code.
    "last_repayment_date", -- The date specified in the loan/credit agreement (amended for any partial prepayments) on which the last principal installment must be repaid by the Borrower.
    "cancelled_amount", -- The portion of the undisbursed balance which has been cancelled (i.e. no longer available for future disbursement).  Cancellations include terminations (where approved loan agreements were never signed).
    "project_name", -- Short descriptive project name.
    "currency_of_commitment", -- The currency in which a borrower’s loan, credit, grant or trust fund is denominated.
    "end_of_period", -- End of Period Date represents the date as of which balances are shown in the report.
    "due_3rd_party" -- Amount due to a third party.
FROM
    "finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj:latest"."ida_statement_of_credits_and_grants_latest"
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 finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at finances.worldbank.org. When you queryfinances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj: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 finances.worldbank.org, 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 \
  "finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj" \
  --handler-options '{
    "domain": "finances.worldbank.org",
    "tables": {
        "ida_statement_of_credits_and_grants_latest": "ebmi-69yj"
    }
}'

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, finances-worldbank/ida-statement-of-credits-and-grants-latest-ebmi-69yj is just another Postgres schema.

Related Documentation: