On Tue, Mar 23, 2010 at 12:57:19AM -0300, Juan Manuel Santos wrote:
> Are there any ideas on why would SQLO 
> be a bit slower

   When you declare a table

class MyTable(SQLObject):
   ...columns...

and do an INSERT by calling MyTable(columns) SQLObject immediately does a
SELECT to get back autogenerated fields (timestamps and the like) This is
slow. It's ok to create rows like this occasionally but it is certainly bad
for mass-insertion.
   For mass-insertion use SQLBuilder. Alas, it's underdocumented. Go by
example:

record = {'column1': value1, 'column2': value2, ...}

connection.query(connection.sqlrepr(
   sqlbuilder.Insert(MyTable.sqlmeta.table, values=record)))

   These are simple straightforward INSERTs without any additional
high-level burden - no SELECT, no caching, nothing. Fire and forget.
   It is not as high-level as calling MyTable() but it is still high
enough - sqlrepr() does value conversion and quoting, e.g.

Oleg.
-- 
     Oleg Broytman            http://phd.pp.ru/            p...@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to