Created
March 31, 2020 16:41
-
-
Save geobabbler/293717732cd3486b56ae9416eed57202 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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