Changeset 733
- Timestamp:
- 02/22/10 21:21:23 (7 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/npemap.org.uk/scripts/generic-python-import/generic_importer.py
r705 r733 192 192 193 193 194 # Grab all of the current ones 195 sql = "SELECT id, outward, inward, deleted FROM postcodes WHERE source = %s AND NOT deleted"194 # Grab all of the current ones, including deleted ones 195 sql = "SELECT id, outward, inward, deleted FROM postcodes WHERE source = %s" 196 196 sth = dbh.cursor() 197 197 sth.execute(sql, source_id) … … 215 215 sth.close() 216 216 217 print "There are currently %d entries in the database from the %s. (Additionally, there are %d deleted ones)" % (count , self.source_name, deleted_count)217 print "There are currently %d entries in the database from the %s. (Additionally, there are %d deleted ones)" % (count-deleted_count, self.source_name, deleted_count) 218 218 print "The new import contains %d entries" % len(postcodes) 219 219 … … 252 252 253 253 if spcs.has_key(pc): 254 # Update existing one 254 # If it's previously been deleted, just skip it 255 if spcs[pc]['deleted']: 256 if self.verbose: 257 print "\tSkipping as previously deleted (id %d)" % spcs[pc]['id'] 258 continue 259 260 # Otherwise, update the existing entry 255 261 spcs[pc]['done'] = True 256 262 sth.execute(upd_sql, (postcode["outer"], postcode["inner"], postcode["raw_outer"], postcode["raw_inner"], postcode["easting"], postcode["northing"], postcode["ie_easting"], postcode["ie_northing"], spcs[pc]['id']))
