Project

General

Profile

« Previous | Next » 

Revision 5643

tnrs_db: Fixed bug where needed to remove internal identifyingtaxonomicname duplicates as well as duplicates with existing Name_submitted values, to avoid violating the TNRS.tnrs pkey constraint when the scrubbed names are later inserted. Note that the taxonlabel_0_unique_identifying_name unique index is not sufficient to prevent internal duplicates, because it includes the creator_id (and thus allows multiple instances of the same name defined by different creators).

View differences:

tnrs_db
49 49
    total_pause = 0
50 50
    tables = ['taxonlabel', sql_gen.Join('tnrs',
51 51
        {'Name_submitted': 'identifyingtaxonomicname'}, sql_gen.filter_out)]
52
    cols = ['identifyingtaxonomicname']
52 53
    # Has a concatenated name and not already linked to an accepted name
53 54
    conds = [('identifyingtaxonomicname', sql_gen.CompareCond(None, '!=')),
54 55
        ('matched_label_id', None)]
55 56
    while True:
56 57
        # Fetch next set
57
        cur = sql.select(db, tables, ['identifyingtaxonomicname'], conds,
58
            limit=tnrs.max_names, cacheable=False)
58
        cur = sql.select(db, tables, cols, conds, cols, limit=tnrs.max_names,
59
            cacheable=False)
59 60
        this_ct = cur.rowcount
60 61
        log('Processing '+str(this_ct)+' taxonlabels')
61 62
        if this_ct == 0:

Also available in: Unified diff