<div dir="ltr">guarda se รจ il tuo caso<br><br><a href="http://mysql-python.sourceforge.net/FAQ.html#other-errors">http://mysql-python.sourceforge.net/FAQ.html#other-errors</a><br><br>Starting with 1.2.0, MySQLdb disables autocommit by default, as required by the DB-API standard (PEP-249). If you are using InnoDB tables or some other type of transactional table type, you'll need to do connection.commit() before closing the connection, or else none of your changes will be written to the database.<br>
<br>Grazia<br><br><div class="gmail_quote">On Mon, Oct 6, 2008 at 9:25 PM, Francesco Martino <span dir="ltr"><<a href="mailto:francesco.martino@unipd.it">francesco.martino@unipd.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Chiedo scusa ma ho riportato il codice in modo errato.<br>
Di seguito si trova quello corretto:<br>
<div class="Ih2E3d"><br>
<br>
****************************************************************************************************************<br>
import MySQLdb<br>
<br>
db = MySQLdb.connect(host = 'localhost', db = 'nome_db', user = 'user',<br>
passwd = 'password')<br>
cur = db.cursor()<br>
<br>
</div>def createTable(curs):<br>
<div class="Ih2E3d"> curs.execute('SELECT tab1.valA, tab1.valB, tab2.valC, tab2.valD\<br>
FROM tab1 JOIN tab2 \<br>
ON tab1.valE = tab2.valE\<br>
WHERE tab1.valA>0')<br>
for data in cur.fetchall():<br>
dataList.append(data)<br>
</div> curs.execute('CREATE TABLE tab3 (\<br>
<div class="Ih2E3d"> valA char(50),\<br>
valB char(50),\<br>
valC char(50),\<br>
valD char(50))')<br>
print 'tabella costruita...'<br>
curs.executemany("INSERT INTO tab3 (valA, valB, valC, valD) \<br>
VALUES (%s,%s,%s,%s)", dataList)<br>
print 'valori inseriti'<br>
<br>
if __name__= '__main__':<br>
createTable(cur)<br>
****************************************************************************************************************<br>
<br>
</div><div><div></div><div class="Wj3C7c">Francesco<br>
_______________________________________________<br>
Python mailing list<br>
<a href="mailto:Python@lists.python.it">Python@lists.python.it</a><br>
<a href="http://lists.python.it/mailman/listinfo/python" target="_blank">http://lists.python.it/mailman/listinfo/python</a><br>
</div></div></blockquote></div><br></div>