[SQLObject] Create an object - INSERT+SELECT
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Oleg B. <ph...@ph...> - 2004-04-28 12:53:08
|
Hello! Preamble. I am developing a site that consists of FTP scanner and a web interface to the database full of files descriptions. The scanner and the site have been running for some time. I use QPS (http://ppa.sf.net/); actually I use only qBricks module, which is a kind of ORM, oriented towards QPS needs. Now I am trying to replace qBricks with SQLObject. And I found that the scanner became very slow. Slow as death :( qBricks-based scanner scanned my FTP for about 10 seconds (just did LIST -R and parsed the answer) and spent 2-3 minutes to INSERT all descriptions. SQLObject-based scanner was running for about 15 minutes, and I killed it to investigate its slowness. First problem that I see in the log is that SQLObject does a SELECT for every INSERT: 1/QueryIns: INSERT INTO files (id, updated, mtime, directory, resource, size, dnld_count, filename) VALUES (24577, 't', '2002-11-05 00:00:00', '/pub/Software/Java', 1, '22839295', 0, 'j2re-1_4_1_01-linux-i586.bin') 1/COMMIT : auto 1/QueryOne: SELECT resource, updated, filename, mtime, directory, dnld_count, size FROM files WHERE id = 24577 1/COMMIT : auto 1/QueryIns: INSERT INTO files (id, updated, mtime, directory, resource, size, dnld_count, filename) VALUES (24578, 't', '2002-11-14 00:00:00', '/pub/Software/Java', 1, '9937344', 0, 'j2re-1_4_1_01-windows-i586-i.exe') 1/COMMIT : auto 1/QueryOne: SELECT resource, updated, filename, mtime, directory, dnld_count, size FROM files WHERE id = 24578 1/COMMIT : auto Why? SQLObject has got all neccessary information - all values for all columns. Why does it SELECT them back? Well, even if it really needs it - I want to stop it in this particular case. After the INSERT I don't need the object - the program is moving to the next object and the next INSERT. How can I do it - INSERT without SELECT? SQLObject 0.5.2, PostgreSQL. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |