MySQL why cursor.execute(sql, multi=True) does not work but 2 cursor.execute(sql) works?
<p>This code works:</p>

<pre><code>sql = """TRUNCATE TABLE product_groups;"""
cursor.execute(sql)

sql = """INSERT INTO product_groups (origin, type, name, brand, concentration, gender) 
            SELECT origin, type, name, brand, concentration, gender
            FROM products
            GROUP BY origin, type, name, brand, concentration, gender
            ORDER BY brand, name;"""
cursor.execute(sql)

cursor.close()
conn.commit()
conn.close()
</code></pre>

<p>this code does not work:</p>

<pre><code>sql = """TRUNCATE TABLE product_groups;
            INSERT INTO product_groups (origin, type, name, brand, concentration, gender) 
            SELECT origin, type, name, brand, concentration, gender
            FROM products
            GROUP BY origin, type, name, brand, concentration, gender
            ORDER BY brand, name;"""
cursor.execute(sql, multi=True)

cursor.close()
conn.commit()
conn.close()
</code></pre>

<p>The difference between two codes is just the cursor.execute().
In the first code, we have 2 cursor.execute(sql).
In the second code, we have 1 cursor.execute(sql, multi=True) with 2 SQL statements.</p>

<p>Both codes doesn't rise errors, but, the second code does not insert rows.</p>

<p>why just the first code works?</p>