from db_setup import create_connection
from pandas import DataFrame, read_csv, to_sql


def create_dataframe() -> DataFrame:
    csv_file = "../data/igdb.csv"
    df = read_csv(csv_file)
    return df


def insert_data(df, conn):
    df.to_sql("glacier", con=conn, if_exists="replace", index=False)


def main():
    conn = create_connection()
    df = create_dataframe()
    insert_data(df, conn)


if __name__ == "__main__":
    main()
