opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t
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 md_covid19_master_case_tracker table in this repository, by referencing it like:

"opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t:latest"."md_covid19_master_case_tracker"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "adultacutehospitalizations",
    "pedicuhospitalizations",
    "adulticuhospitalizations",
    "pedacutehospitalizations",
    "pdeathnotavail", -- Probable Deaths Data Not Available
    "pdeathother", -- Probable Deaths Other (NH)
    "pdeathasian", -- Probable Deaths Asian (NH)
    "pdeathhispanic", -- Probable Deaths Hispanic
    "pdeathwhite", -- Probable Deaths White (NH)
    "pdeathaframer", -- Probable Deaths African American
    "pdeathgenunkn", -- Probable Deaths Gender Unknown
    "pdeathgenfemale", -- Probable Deaths Gender Female
    "pdeathgenmale", -- Probable Deaths Gender Male
    "pdeathageunknown", -- Probable Deaths for people Age Unknown
    "pdeath80plus", -- Probable Deaths for people 80 plus
    "pdeath70to79", -- Probable Deaths for people 70 to 79 
    "pdeath60to69", -- Probable Deaths for people 60 to 69 
    "pdeath50to59", -- Probable Deaths for people 50 to 59 
    "pdeath40to49", -- Probable Deaths for people 40 to 49 
    "pdeath30to39", -- Probable Deaths for people 30 to 39 
    "pdeath20to29", -- Probable Deaths for people 20 to 29 
    "pdeath10to19", -- Probable Deaths for people 10 to 19 
    "pdeath0to9", -- Probable Deaths for people 0 to 9 
    "pdeathunkn", -- Probable Deaths from COVID-19 County Unknown
    "pdeathworc", -- Probable Deaths from COVID-19 Worcester
    "pdeathwico", -- Probable Deaths from COVID-19 Wicomico
    "pdeathwash", -- Probable Deaths from COVID-19 Washingon
    "pdeathtalb", -- Probable Deaths from COVID-19 Talbot
    "pdeathstma", -- Probable Deaths from COVID-19 St. Mary's
    "pdeathsome", -- Probable Deaths from COVID-19 Somerset
    "pdeathquee", -- Probable Deaths from COVID-19 Queen Anne's
    "pdeathprin", -- Probable Deaths from COVID-19 Prince George's
    "pdeathmont", -- Probable Deaths from COVID-19 Montgomery
    "pdeathkent", -- Probable Deaths from COVID-19 Kent
    "pdeathhowa", -- Probable Deaths from COVID-19 Howard
    "pdeathharf", -- Probable Deaths from COVID-19 Harford
    "pdeathgarr", -- Probable Deaths from COVID-19 Garrett
    "pdeathfred", -- Probable Deaths from COVID-19 Frederick
    "pdeathdorc", -- Probable Deaths from COVID-19 Dorchester
    "pdeathchar", -- Probable Deaths from COVID-19 Charles
    "pdeathceci", -- Probable Deaths from COVID-19 Cecil
    "pdeathcarr", -- Probable Deaths from COVID-19 Carroll
    "pdeathcaro", -- Probable Deaths from COVID-19 Caroline
    "pdeathcalv", -- Probable Deaths from COVID-19 Calvert
    "pdeathbcity", -- Probable Deaths from COVID-19 Baltimore City
    "pdeathbalt", -- Probable Deaths from COVID-19 Baltimore
    "pdeathanne", -- Probable Deaths from COVID-19 Anne Arundel
    "pdeathalle", -- Probable Deaths from COVID-19 Allegany
    "pdeathdod", -- Probable Death Date of Death
    "pdeathsdelta", -- Delta of Cumulative Probable Deaths
    "pdeaths", -- Cumulative Probable Deaths
    "deathnotavail", -- Cumulative Deaths Data Not Available
    "deathother", -- Cumulative Deaths Other (NH)
    "deathasian", -- Cumulative Deaths Asian (NH)
    "deathhispanic", -- Cumulative Deaths Hispanic
    "deathwhite", -- Cumulative Deaths White (NH)
    "deathaframer", -- Cumulative Deaths African-American
    "deathgenunkn", -- Cumulative Deaths for the Gender Unknown
    "deathgenfemale", -- Cumulative Deaths for the Gender Female
    "deathgenmale", -- Cumulative Deaths for the Gender Male
    "deathageunknown", -- Cumulative deaths for people Age Unknown
    "death80plus", -- Cumulative deaths for people 80 plus
    "death70to79", -- Cumulative deaths for people 70 to 79 
    "death60to69", -- Cumulative deaths for people 60 to 69 
    "death50to59", -- Cumulative deaths for people 50 to 59 
    "death40to49", -- Cumulative deaths for people 40 to 49 
    "death30to39", -- Cumulative deaths for people 30 to 39 
    "death20to29", -- Cumulative deaths for people 20 to 29 
    "death10to19", -- Cumulative deaths for people 10 to 19 
    "death0to9", -- Cumulative deaths for people 0 to 9 
    "deathunkn", -- Cumulative Deaths from COVID-19 County Unknown
    "deathworc", -- Cumulative Deaths from COVID-19 Worcester
    "deathwico", -- Cumulative Deaths from COVID-19 Wicomico
    "deathwash", -- Cumulative Deaths from COVID-19 Washington
    "deathtalb", -- Cumulative Deaths from COVID-19 Talbot
    "deathstma", -- Cumulative Deaths from COVID-19 St. Mary's
    "deathsome", -- Cumulative Deaths from COVID-19 Somerset
    "deathquee", -- Cumulative Deaths from COVID-19 Queen Anne's
    "deathprin", -- Cumulative Deaths from COVID-19 Prince George's
    "deathmont", -- Cumulative Deaths from COVID-19 Montgomery
    "deathkent", -- Cumulative Deaths from COVID-19 Kent
    "deathhowa", -- Cumulative Deaths from COVID-19 Howard
    "deathharf", -- Cumulative Deaths from COVID-19 Harford
    "deathgarr", -- Cumulative Deaths from COVID-19 Garrett
    "deathfred", -- Cumulative Deaths from COVID-19 Frederick
    "deathdorc", -- Cumulative Deaths from COVID-19 Dorchester
    "deathchar", -- Cumulative Deaths from COVID-19 Charles
    "deathceci", -- Cumulative Deaths from COVID-19 Cecil
    "deathcarr", -- Cumulative Deaths from COVID-19 Carroll
    "deathcaro", -- Cumulative Deaths from COVID-19 Caroline
    "deathcalv", -- Cumulative Deaths from COVID-19 Calvert
    "deathbcity", -- Cumulative Deaths from COVID-19 Baltimore City
    "deathbalt", -- Cumulative Deaths from COVID-19 Baltimore
    "deathanne", -- Cumulative Deaths from COVID-19 Anne Arundel
    "deathalle", -- Cumulative Deaths from COVID-19 Allegany
    "deathdod", -- Death Date of Death
    "deathsdelta", -- Delta of Cumulative Statewide Deaths for COVID-19
    "deaths", -- Cumulative Statewide Deaths for COVID-19
    "casenotavail", -- Cumulative Cases Data not available
    "caseother", -- Cumulative Cases Other (NH)
    "caseasian", -- Cumulative Cases Asian (NH)
    "casehispanic", -- Cumulative Cases Hispanic
    "casewhite", -- Cumulative Cases White (NH)
    "caseaframer", -- Cumulative Cases African-American
    "genunkn", -- Cumulative Cases for the Gender Unknown
    "genfemale", -- Cumulative Cases for the Gender Female
    "genmale", -- Cumulative Cases for the Gender Male
    "caseageunknown", -- Cumulative Cases Age Unknown
    "case80plus", -- Cumulative Cases for people 80 plus
    "case70to79", -- Cumulative Cases for people 70 to 79
    "case60to69", -- Cumulative Cases for people 60 to 69
    "case50to59", -- Cumulative Cases for people 50 to 59
    "case40to49", -- Cumulative Cases for people 40 to 49
    "case30to39", -- Cumulative Cases for people 30 to 39 
    "case20to29", -- Cumulative Cases for people 20 to 29 
    "case10to19", -- Cumulative Cases for people 10 to 19 
    "case0to9", -- Cumulative Cases for people 0 to 9 
    "_65plus",
    "_18to64",
    "under18",
    "unkn", -- Unknown Cumulative Cases
    "worc", -- Worcester County Cumulative Cases
    "wico", -- Wicomico County Cumulative Cases
    "wash", -- Washington County Cumulative Cases
    "talb", -- Talbot County Cumulative Cases
    "stma", -- St. Mary's County Cumulative Cases
    "some", -- Somerset County Cumulative Cases
    "quee", -- Queen Anne's County Cumulative Cases
    "prin", -- Prince George's County Cumulative Cases
    "mont", -- Montgomery County Cumulative Cases
    "kent", -- Kent County Cumulative Cases
    "howa", -- Howard County Cumulative Cases
    "harf", -- Harford County Cumulative Cases
    "garr", -- Garrett County Cumulative Cases
    "fred", -- Frederick County Cumulative Cases
    "dorc", -- Dorchester County Cumulative Cases
    "char", -- Charles County Cumulative Cases
    "ceci", -- Cecil County Cumulative Cases
    "carr", -- Carroll County Cumulative Cases
    "caro", -- Caroline County Cumulative Cases
    "calv", -- Calvert County Cumulative Cases
    "bcity", -- Baltimore City Cumulative Cases
    "balt", -- Baltimore County Cumulative Cases
    "anne", -- Anne Arundel County Cumulative Cases
    "alle", -- Allegany County Cumulative Cases
    "releaseddelta", -- Delta of Cumulative Number of People Released from Isolation
    "total_released", -- Cumulative Number of People Released from Isolation
    "hospitalizeddelta", -- Delta of Cumulative Number of people Hospitalized
    "total_hospitalized", -- Cumulative Number of people Hospitalized
    "bedsdelta", -- Delta of Total Number of Hospital Beds
    "bedsicu", -- Number of ICU Hospital Beds
    "bedsacute", -- Number of Acute Care Hospital Beds
    "bedstotal", -- Total Number of Hospital Beds
    "negdelta", -- Delta of Cumulative Number of Negative Tests
    "negativetests", -- Cumulative Number of Negative Tests
    "pospercentdiff", -- Delta of 7-Day Rolling Average Positive Testing percent
    "postestpercent", -- 7-Day Rolling Average Positive Testing percent
    "testsdelta", -- Delta of the Number of COVID-19 Tests
    "totaltests", -- Cumulative Number of COVID-19 Tests
    "casedelta", -- COVID-19 Case Delta
    "totalcases", -- Cumulative COVID-19 Cases 
    "reportdate", -- Report Date
    "filter"
FROM
    "opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t:latest"."md_covid19_master_case_tracker"
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 opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at opendata.maryland.gov. When you queryopendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t: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)"
 

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 (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 opendata.maryland.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 \
  "opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t" \
  --handler-options '{
    "domain": "opendata.maryland.gov",
    "tables": {
        "md_covid19_master_case_tracker": "mgd3-qk8t"
    }
}'

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, opendata-maryland-gov/md-covid19-master-case-tracker-mgd3-qk8t is just another Postgres schema.