Changeset 734 for trunk


Ignore:
Timestamp:
Feb 24, 2010, 12:58:17 PM (10 years ago)
Author:
Nick Burch
Message:

When we have both a deleted and undeleted postcode in the database, prefer the undeleted one

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/npemap.org.uk/scripts/generic-python-import/generic_importer.py

    r733 r734  
    193193
    194194                # Grab all of the current ones, including deleted ones
    195                 sql = "SELECT id, outward, inward, deleted FROM postcodes WHERE source = %s"
     195                sql = "SELECT id, outward, inward, deleted FROM postcodes WHERE source = %s ORDER BY deleted DESC"
    196196                sth = dbh.cursor()
    197197                sth.execute(sql, source_id)
    198198
     199        # Loop over all rows. Non-deleted come last, so it doesn't matter
     200        #  if we override early occurances of a postcode
    199201                spcs = {}
    200202                while 1:
Note: See TracChangeset for help on using the changeset viewer.