finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3
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 ibrd_statement_of_loans_historical_data table in this repository, by referencing it like:

"finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3:latest"."ibrd_statement_of_loans_historical_data"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "last_disbursement_date", -- The date on which the last disbursement was made (prior to the end of period date).
    "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.
    "board_approval_date", -- The date the World Bank approves the loan. 
    "agreement_signing_date", -- The date the borrower and the Bank sign the loan agreement.
    "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.
    "due_3rd_party", -- Amount due to a third party.
    "sold_3rd_party", -- Portion of loan sold to a third party.
    "due_to_ibrd", -- Where the exchange adjustment is shown separately, this is the amount disbursed and outstanding expressed as a stock of debt in historical US Dollars.   Where the exchange adjustment is not shown separately, this is the amount due and outstanding as of th
    "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).
    "original_principal_amount", -- The original US dollar amount of the loan that is committed and approved.  
    "guarantor", -- The Guarantor guarantees repayment to the Bank if the borrower does not repay. 
    "guarantor_country_code", -- Country Code of the Guarantor according to the World Bank country list. Might be different from the ISO country code.
    "borrower", -- The representative of the borrower to which the Bank loan is made. 
    "country_code", -- Country Code according to the World Bank country list. Might be different from the ISO country code.
    "repaid_to_ibrd", -- Total principal amounts paid or prepaid to IBRD in US dollars, calculated at the exchange rate on the value date of the individual repayments. 
    "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.  
    "loan_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’.
    "project_name_", -- Short descriptive project name.
    "loan_type", -- A type of loan/loan instrument for which distinctive accounting and/or other actions need to be performed. See Data Dictionary attached in the About section or Data Dictionary dataset available from the list of all datasets for details.
    "end_of_period", -- End of Period Date represents the date as of which balances are shown in the report.
    "first_repayment_date", -- The date on which principal repayment starts.
    "loans_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. 
    "repaid_3rd_party", -- Amount repaid to a third party.
    "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.  
    "exchange_adjustment", -- The increase (decrease) in value of disbursed and outstanding amount due to exchange rate fluctuations.  This amount added to “Due to IBRD” yields “Borrower’s Obligation; includes exchange adjustments on the amounts Due to 3rd parties.
    "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.
    "interest_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", -- Country to which loan has been issued. Loans to the IFC are included under the country “World”. 
    "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.
    "project_id", -- A Bank project is referenced by a project ID (Pxxxxxxx).  More than one loan or credit may be associated with one Project ID. 
    "loan_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.
    "currency_of_commitment" -- The currency in which a borrower’s loan, credit, grant or trust fund is denominated.
FROM
    "finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3:latest"."ibrd_statement_of_loans_historical_data"
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/ibrd-statement-of-loans-historical-data-zucq-nrc3 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 finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3: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 finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3

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 finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3:latest

This will download all the objects for the latest tag of finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3 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 finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3: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 finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3: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, finances-worldbank/ibrd-statement-of-loans-historical-data-zucq-nrc3 is just another Postgres schema.

Related Documentation:

Loading...