[SQLObject] disabling select after insert on newly created objects
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Dave P. <dpo...@te...> - 2003-08-06 14:07:01
|
I've noticed that 2 (well 3, but commit is ok) queries gets done everytime I create a new record in the database: 7726 Query INSERT INTO smdr_uniformized (extension, dialed, source_id, start_time, call_type_id, source_row, pbx_id, system_id, end_time, trunk, transaction_id, tenant) VALUES (208, '', 1, '20030509162933', 1, 2998, 1, 2, '20030509163138', 100, 1, 1) 7726 Query COMMIT 7726 Query SELECT transaction_id, extension, dialed, start_time, source_row, system_id, pbx_id, source_id, end_time, trunk, call_type_id, tenant FROM smdr_uniformized WHERE id = 2969 Is there a way to tell SQLObject not to perform this select everytime I create a new Smdr_uniformized object? code reference: --------------- record_count = len( Smdr_nec_2400.select( Smdr_nec_2400.q.transactionID == trans.id )) print "converting",record_count, "records.<br />" for record_start in range(0,record_count,100): print record_start, '...' for smdr_nec_2400 in Smdr_nec_2400.select( Smdr_nec_2400.q.transactionID == trans.id )[record_start:record_start + 99]: #--# Uniformize Start/End time #--# # \---------------------------/ # uniform_start_time = '20'\ + smdr_nec_2400.start_time_year\ + smdr_nec_2400.start_time uniform_end_time = '20'\ + smdr_nec_2400.end_time_year\ + smdr_nec_2400.end_time #--# Create Uniformized Record #--# # \---------------------------/ # Smdr_uniformized.new( system = smdr_nec_2400.systemID, source = 1, source_row = smdr_nec_2400.id, pbx = smdr_nec_2400.pbxID, tenant = smdr_nec_2400.tenant_no, extension = smdr_nec_2400.extension_no, trunk = smdr_nec_2400.trunk_no, start_time = uniform_start_time, end_time = uniform_end_time, call_type = nec_calltypes[ smdr_nec_2400.type_of_record ], dialed = smdr_nec_2400.called_no, transaction = trans.id ) print "completed.<br />" --------------------- end of code reference Also, thanks to Frank Barknecht for his code snippet, allowed me to figure out how to do limits using SQLObject! :) Thanks, -Dave. |