import collections


def get_sectors(n_con):
    """
    INPUTS:
        n_con (mysql) - A "normal" pymysql database connection
    OUTPUT:
        Dictionary with sectors as keys, and lists of ticker_id's as values
    """
    sectors = collections.defaultdict(list)
    with n_con.cursor() as n_cur:
        n_cur.execute("SELECT sector,id FROM symbols where flag='a';")
        results = n_cur.fetchall()
    for result in results:
        sectors[result[0]].append(result[1])

    return sectors