...and the reason that it works on the older tables is probably that they use the MyISAM engine rather than InnoDB.
On Mon, Jul 25, 2016 at 12:05 PM, Mehdi gmira <mgm...@wiremind.fr> wrote: > Maybe you forgot to commit ? > > > Le lundi 25 juillet 2016 12:08:17 UTC+2, Rogier Eggers a écrit : >> >> Hello, >> >> I have an old script that I'm upgrading. It uses sqlalchemy connect and >> then execute statements to send raw sql as strings to the database (mysql). >> The problem that I'm having is that an insert statement that I issue in this >> way is seemingly handled by sqlalchemy without problems (I don't get any >> error from sqlalchemy) and I can also get a new LAST_INSERT_ID(). However, >> the respective record does not appear in the database. If I issue the exact >> same string as a command in the mysql client directly, the record is created >> without problems. >> >> The odd thing is that it happens only on a newly created table. I did feed >> some initial data through the mysql client. Identical commands on existing >> other tables work without problem. >> >> My question is: what could possibly be the reason and how could I debug >> this to find the cause? >> >> The simplified code: >> db = MySQLdb.connect(host="localhost", user="username", passwd="password", >> db=dbName) >> cursor = db.cursor() >> cursors.execute('INSERT INTO clients SET Name="Client1";') >> >> The sql structure of the problematic table is as follows: >> CREATE TABLE IF NOT EXISTS `clients` ( >> `id` int(11) NOT NULL, >> `Name` text CHARACTER SET latin1 COLLATE latin1_general_ci >> ) ENGINE=InnoDB DEFAULT CHARSET=latin1; >> ALTER TABLE `clients` >> ADD PRIMARY KEY (`id`); >> ALTER TABLE `clients` >> MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; >> > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.