Anthra Norell wrote:
> Very true!
> I could verify that cursor.execute () seems to understand "... %s
...",
> ..."string"... where print () doesn't.. I didn't know that.
> I could also verify that gumfish's ineffective insertion command
works fine
> for me. (Python 2.4, mysql-3.23.38). So it looks
o it looks like the problem is with
MySQL (e.g. table name, column names, ...)
Frederic
- Original Message -
From: "Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Monday, March 14, 2005 11:55 PM
Subject: Re: Can't seem to
In <[EMAIL PROTECTED]>, Anthra Norell
wrote:
> Try to use % instead of a comma (a Python quirk) and quotes around your
> strings (a MySQL quirk):
>
>cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES ('%s',
> '%s', '%s')" % ("a", "b", "c") )
AFAIK grumfish made the Right Thingâ.
Original Message -
From: "grumfish" <[EMAIL PROTECTED]>
Newsgroups: comp.lang.python
To:
Sent: Saturday, March 12, 2005 7:24 PM
Subject: Can't seem to insert rows into a MySQL table
> I'm trying to add a row to a MySQL table using insert. Here is the code:
>
deelan wrote:
which version of MySQLdb are you running? versions
1.1.6 and below gained a connection.autocommit) method set by default
ehm, 1.1.6 and *above*, of course. :)
--
"Però è bello sapere che, di questi tempi spietati, almeno
un mistero sopravvive: l'età di Afef Jnifen." -- dagospia.com
-
grumfish wrote:
I'm trying to add a row to a MySQL table using insert. Here is the code:
connection = MySQLdb.connect(host="localhost", user="root", passwd="pw",
db="japanese")
cursor = connection.cursor()
cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s,
%s)", ("a", "b", "
grumfish wrote:
The rowcount of the
cursor is 1 after the execute is 1 and the table's auto_increment value
is increased for each insert done.
If the auto_increment is increased, then it seems like the row was
inserted. Are you sure the problem is not with your SELECT attempt?
Just a guess, b
grumfish wrote:
connection = MySQLdb.connect(host="localhost", user="root", passwd="pw",
db="japanese")
cursor = connection.cursor()
cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s,
%s)", ("a", "b", "c") )
connection.close()
Just a guess "in the dark" (I don't use MySQL):
I'm trying to add a row to a MySQL table using insert. Here is the code:
connection = MySQLdb.connect(host="localhost", user="root", passwd="pw",
db="japanese")
cursor = connection.cursor()
cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s,
%s)", ("a", "b", "c") )
connection