import random
import mysql.connector

def insert_sql():
    conn = mysql.connector.connect(
        host="localhost",
        user="root",
        password="")

    cursor = conn.cursor()
    r = "CREATE DATABASE IF NOT EXISTS wezz"
    cursor.execute( r )
    r = """CREATE TABLE IF NOT EXISTS wezz.simulations
        (id INT PRIMARY KEY AUTO_INCREMENT UNIQUE,
         a INT, b INT, c INT, s INT)"""

    cursor.execute( r )

    for k in range(100):
        a = randint(1,20)
        b = randint(1,20)
        c = randint(1,20)
        w = wezz(a,b,c)
        s = w.fct()
        r = """INSERT INTO wezz.simulations
            (a,b,c,s) VALUES (%s,%s,%s,%s)"""
        val = (a,b,c,s)
        cursor.execute(r , val )

    conn.commit()
    cursor.close()
    conn.close()