igdb/code/database/storage.py

23 lines
438 B
Python
Raw Normal View History

2020-01-06 08:31:21 +01:00
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()