for df in list(dfs.keys()):
    cols = dfs[df].columns
cols = [str(col) for col in cols if 'id' in col.lower()]
schema = pd.io.sql.get_schema(dfs[df], df, con=db.engine, keys=cols)
db.engine.execute('DROP TABLE ' + df + ';')
db.engine.execute(schema)
dfs[df].to_sql(df, con=db.engine, index=False, if_exists='append')
Python Pandas to_sql, how to create a table with a primary key?