Re: [sqlite] SQL approach to Import only new items, delete other items

2007-09-07 Thread Dwight Ingersoll
On 9/6/07, Andre du Plessis <[EMAIL PROTECTED]> wrote: > Im importing data > > The data has a unique value, call it MD5 for now that could be a unique > value for the data. > > > > Each record that gets imported is converted to MD5, a lookup is done on > the table for that MD5, > > if found it mu

Re: [sqlite] SQL approach to Import only new items, delete other items

2007-09-06 Thread Scott Hess
You could invert your solution. Create a temporary table which contains all of the existing keys, and every time you insert a new item, delete that item's key from the temporary table. At the end, do something like 'DELETE FROM main_table WHERE key IN (SELECT key FROM tmp_table)'. -scott On 9/6

RE: [sqlite] SQL approach to Import only new items, delete other items

2007-09-06 Thread Tom Briggs
> Because my concern is this, I don't know how SQLite will do > > Delete from table where col not in (select from large temp dataset) > > How the delete will actually be walked, if it will create a serverside > cursor and walk the values in the in statement then it will > be fine and > fast,

RE: [sqlite] SQL approach to Import only new items, delete other items

2007-09-06 Thread Andre du Plessis
EMAIL PROTECTED] Sent: 06 September 2007 03:33 PM To: sqlite-users@sqlite.org Subject: RE: [sqlite] SQL approach to Import only new items, delete other items Your suggested temp table approach is how I would solve this; if everything is properly indexed it won't be too bad. Even if it is bad

RE: [sqlite] SQL approach to Import only new items, delete other items

2007-09-06 Thread Tom Briggs
tasets, I think. Depends on how much data is already in the database vs. the amount of data being loaded. -Tom > -Original Message- > From: Andre du Plessis [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 06, 2007 5:41 AM > To: sqlite-users@sqlite.org > Subject: [

[sqlite] SQL approach to Import only new items, delete other items

2007-09-06 Thread Andre du Plessis
Im importing data The data has a unique value, call it MD5 for now that could be a unique value for the data. Each record that gets imported is converted to MD5, a lookup is done on the table for that MD5, if found it must leave it alone, if not found it must insert a new record... All t