Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
###################################################
# Bash script to pull JHU data and update
###################################################
#Set the value of variable
database="$1"
user="$2"
host="$3"
pw="$4"
export PGPASSWORD="$4"
ogr2ogr -overwrite -f "PostGreSQL" PG:"host=$host user=$user dbname=$database password=$pw" 'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/ArcGIS/rest/services/ncov_cases_US/FeatureServer/0/query?where=1%3D1&outFields=*&f=geojson&token=' -nln jhu_county_current
psql -d $database -h $host -U $user -c "UPDATE jhu_county a SET last_update = b.last_update, confirmed = b.confirmed FROM jhu_county_current b WHERE a.combined_key = b.combined_key AND a.confirmed <> b.confirmed;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.