Where does MySQLdb put inserted data?

F

F.R.

Hi,
As of late clipboard pasting into a terminal sometimes fails (a
known bug, apparently), I use MySQLdb to access MySQL tables. In general
this works just fine. But now I fail filling a new table. The table
exists. "mysql>EXPLAIN new_table;" explains and "root@blackbox-one:/#
sudo/find / -name 'new_table*'" finds "/var/lib/mysql/fr/new_table.frm".
So I do "cursor.executemany ('insert into new_table values (%s)' %
format, data)". No error occurs and "cursor.execute ('select * from
new_table;')" returns the number of records read, and "cursor.fetchall
()" returns all new records. All looks fine, but "mysql>SELECT * FROM
new_table;" produces an "Empty set" and "sudo find / -name 'new_table*"
still finds only the format file, same as before.
Could it have to do with COMMIT. I believe I am using ISAM tables
(default?) and those don't recognize undo commands, right?. Anyway, an
experimental "cursor.execute ('COMMIT')" didn't make a difference. It
looks like MySQLdb puts the data into a cache and that cache should be
saved either by the OS or by me. Strange thing is that this is one freak
incident in an almost daily routine going back years and involving
thousands of access operations in and out acting instantaneously. I seem
to remember a similar case some time ago and it also involved a new
empty table.

Thanks for hints

Frederic



mysql> select version()
-> ;
+-------------------------+
| version() |
+-------------------------+
| 5.5.31-0ubuntu0.12.04.1 |
+-------------------------+
1 row in set (0.00 sec)
 
S

Steven D'Aprano

Hi,
As of late clipboard pasting into a terminal sometimes fails (a
known bug, apparently), I use MySQLdb to access MySQL tables.
[...]


You appear to have posted to the wrong list. This is a Python list, not
MySQL. Nothing in your question appears to be about Python. If I am
mistaken, please re-word your question explain what Python code you are
having trouble with, what you tried, what you expected, and what it
actually did.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,187
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top