Splitgraph has been acquired by EDB! Read the blog post.
 
Previous Post
Get your own private Splitgraph data portal
Apr 28, 2022 · By Peter Neumark
READING TIME: 1 min

Planning a vacation with Splitgraph and Observable

Query public Splitgraph repositories from Observable notebooks, by importing the Splitgraph Observable Client to send SQL queries over HTTP to the Splitgraph Data Delivery Network (DDN).

Query Splitgraph from Public Observable Notebooks

Observable has native support for connecting to PostgreSQL from private notebooks and querying SQLite files from public notebooks. Unfortunately, querying large amounts of data from public notebooks has not been supported.

That's changed now thanks to the Splitgraph Observable Client, which lets you query all the public data on the Splitgraph Data Delivery Network (DDN) from any notebook.

Import the client

To use the Splitgraph Observable Client in your own notebook, simply import it from the @splitgraph/ddn notebook. Call the splitgraph function to send SQL queries to the DDN over its HTTP API:

import { splitgraph } from "@splitgraph/ddn"

all_cases = await splitgraph`
SELECT
  date,
  confirmed,
  recovered,
  dead,
  source
FROM "splitgraph/oxcovid19".epidemiology
WHERE countrycode = 'GBR' AND gid = '{"GBR"}' AND source = 'GBR_PHE'
ORDER BY date DESC`

Example notebook

This Planning a family vacation notebook showcases the Observable Splitgraph API:

splitgraph.yml: Terraform for your data stack