Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55454

Where does MySQLdb put inserted data?

Date 2013-10-04 09:38 +0200
From "F.R." <anthra.norell@bluewin.ch>
Subject Where does MySQLdb put inserted data?
Newsgroups comp.lang.python
Message-ID <mailman.709.1380872395.18130.python-list@python.org> (permalink)

Show all headers | View raw


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)

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Where does MySQLdb put inserted data? "F.R." <anthra.norell@bluewin.ch> - 2013-10-04 09:38 +0200
  Re: Where does MySQLdb put inserted data? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-04 08:34 +0000

csiph-web