One minute demo

Assuming you have a PostgreSQL client installed (like psql, pgcli, pgAdmin or DBeaver), you can start querying Splitgraph data in less than a minute.

Connecting to the Splitgraph DDN

Go to splitgraph.com/connect to get your DDN credentials. You can signup via OAuth using your GitHub/GitLab/Google account, or via email/password. Then you'll need to click a button to get your credential, with a SQL username and password.

If you're using psql or pgcli, you can paste the connection string directly:

$ psql postgresql://[API_KEY]:[API_SECRET]@data.splitgraph.com:5432/ddn

You're now ready to run queries against Splitgraph data.

Querying open government data

This sample query that we used in our Metabase demo runs a JOIN between two datasets:

SELECT
    cambridge_cases.date AS date,
    chicago_cases.cases_total AS chicago_daily_cases,
    cambridge_cases.new_positive_cases AS cambridge_daily_cases
FROM
    "cityofchicago/covid19-daily-cases-deaths-and-hospitalizations-naz8-j4nc".covid19_daily_cases_deaths_and_hospitalizations chicago_cases
FULL OUTER JOIN
    "cambridgema-gov/covid19-cumulative-cases-by-date-tdt9-vq5y".covid19_cumulative_cases_by_date cambridge_cases
ON
    date_trunc('day', chicago_cases.lab_report_date) = cambridge_cases.date
ORDER BY date ASC;

This will join the data between two distinct Socrata open government data portals (Chicago, IL and Cambridge, MA).

Querying geospatial data and Splitgraph images

You can also run queries against hosted Splitgraph images. If your client supports PostGIS (like DBeaver or pgAdmin), it will even plot geospatial data.

For example, you can query the London ward boundary data image as follows:

SELECT name, gss_code, ST_Transform(ST_SetSRID(geom, 27700), 4326)
FROM "splitgraph/london_wards".city_merged_2018

Next steps

Splitgraph Cloud hosts or proxies queries to over 40,000 datasets, letting you query them directly from your SQL client.

At the core of Splitgraph Cloud is Splitgraph itself: a self-contained tool for building, sharing and querying data images, inspired by Docker and Git. You can install Splitgraph locally and go through the five minute demo. This will show you how to use Splitgraph to build your own data image from public data, upload it to Splitgraph Cloud and query it through the Splitgraph DDN or a REST API.

You can also use Splitgraph in a stand-alone, decentralized way without using Splitgraph Cloud. The decentralized demo will show you how to spin up multiple Splitgraph instances and share data between them.

Further reading