def _yield_prov_table(ds: DataSource): ds.execute('drop table if exists prov;') ds.execute(""" create table prov( prov_name varchar(12) primary key, prov_cap varchar(12) not null ); """)
def _yield_aqi_info_table(ds: DataSource): ds.execute('drop table if exists aqi_info;') ds.execute(""" create table aqi_info( city_code int(11) not null, DATE DATE not null, aqi int(11) not null, pri_pollutant varchar(25) not null, primary key (city_code, date) ); """)
def _yield_city_prov_table(ds: DataSource): ds.execute('drop table if exists city_prov;') ds.execute(""" create table city_prov( city_code int(11) primary key, city_name varchar(30) not null, prov_name varchar(12) not null, longitude float not null, latitude float not null ); """)
def _yield_cur_data_table(ds: DataSource): ds.execute('drop table if exists cur_data;') ds.execute(""" create table cur_data( city_code int(11) not null, time DATETIME not null, aqi int(11) not null, pm2_5 int(11) not null, pm10 int(11) not null, so2 float not null, no2 float not null, co float not null, o3 float not null, pri_pollutant varchar(25) not null, primary key (city_code, time) ); """)