def sql_query(county_list):
    "\n        Create a SQL query to grab only the user queried cities' data from the covid table in the DB.\n        Output: subset grouped DF by month and city with only queried cities\n        "
    list_length = len(county_list)
    if (list_length == 1):
        county1 = county_list[0]
        query1 = 'SELECT * FROM jobs WHERE county_state IN (%(county1)s)'
        subsetJ = pd.read_sql(sql=query1, columns='county_state', params={'county1': county1}, con=engine, parse_dates=['created_at', 'updated_at'])
    elif (list_length == 2):
        county1 = county_list[0]
        county2 = county_list[1]
        query2 = 'SELECT * FROM jobs WHERE county_state IN (%(county1)s, %(county2)s)'
        subsetJ = pd.read_sql(sql=query2, columns='county_state', params={'county1': county1, 'county2': county2}, con=engine, parse_dates=['created_at', 'updated_at'])
    elif (list_length == 3):
        county1 = county_list[0]
        county2 = county_list[1]
        county3 = county_list[2]
        query3 = 'SELECT * FROM jobs WHERE "county_state" IN (%(county1)s, %(county2)s, %(county3)s)'
        subsetJ = pd.read_sql(sql=query3, columns='county_state', params={'county1': county1, 'county2': county2, 'county3': county3}, con=engine, parse_dates=['created_at', 'updated_at'])
    else:
        raise Exception('Please pass a list of 1-3 City-States')
    return subsetJ
Create a SQL query to grab only the user queried cities' data from the covid table in the DB.
Output: subset grouped DF by month and city with only queried cities
def sql_query(county_list):
    "\n        Create a SQL query to grab only the user queried cities' data from the covid table in the DB.\n        Output: subset grouped DF by month and city with only queried cities\n        "
    list_length = len(county_list)
    if (list_length == 1):
        county1 = county_list[0]
        query1 = 'SELECT * FROM jobs WHERE county_state IN (%(county1)s)'
        subsetJ = pd.read_sql(sql=query1, columns='county_state', params={'county1': county1}, con=engine, parse_dates=['created_at', 'updated_at'])
    elif (list_length == 2):
        county1 = county_list[0]
        county2 = county_list[1]
        query2 = 'SELECT * FROM jobs WHERE county_state IN (%(county1)s, %(county2)s)'
        subsetJ = pd.read_sql(sql=query2, columns='county_state', params={'county1': county1, 'county2': county2}, con=engine, parse_dates=['created_at', 'updated_at'])
    elif (list_length == 3):
        county1 = county_list[0]
        county2 = county_list[1]
        county3 = county_list[2]
        query3 = 'SELECT * FROM jobs WHERE "county_state" IN (%(county1)s, %(county2)s, %(county3)s)'
        subsetJ = pd.read_sql(sql=query3, columns='county_state', params={'county1': county1, 'county2': county2, 'county3': county3}, con=engine, parse_dates=['created_at', 'updated_at'])
    else:
        raise Exception('Please pass a list of 1-3 City-States')
    return subsetJ