conn = mysql.connector.connect(**dbconfig) cursor = conn.cursor() _sql = """insert into db (p, l, ip, browser_string, results) values (%s,%s,%s,%s,%s)""" cursor.execute(_sql, (req.form['p'], req.form['l], req.remote_addr, req.user_agent.browser, res, ))
Попробовал переписать под mariaDB:
import mariadb conn = mariadb.connect(user="user", password="password", host="localhost", database="DB") cursor = conn.cursor() try: cursor.executemany("INSERT INTO log (p,l,ip,browser_string,results) VALUES (?,?,?,?,?)", (request.form['p'], request.form['l'], request.remote_addr, request.user_agent.browser, res,)) except mariadb.Error as e: print(f"Error: {e}")