API to help make public data easier to access. Idea started with need for King County, WA COVID-19 data in API format while only having an excel file for source data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
504 B

import psycopg2
conn = psycopg2.connect("host='localhost' dbname='apiv1' user='postgres' password='postgres'" )
cur = conn.cursor()
cur.execute("""
CREATE TABLE king_county_covid19_zip(
id SERIAL PRIMARY KEY,
date_added DATE NOT NULL DEFAULT CURRENT_DATE,
date_data DATE,
zipcode TEXT,
population INTEGER,
tests INTEGER,
test_rate TEXT,
positives INTEGER,
positive_rate TEXT,
hospitalizations INTEGER,
hospitalization_rate TEXT,
deaths INTEGER,
death_rate TEXT)
""")
conn.commit()