Changeset aa65b36 in osmose-backend


Ignore:
Timestamp:
Mar 13, 2014 7:52:58 PM (6 years ago)
Author:
Frédéric Rodrigo <fred.rodrigo@…>
Branches:
master
Children:
ab1cbee
Parents:
051f570
git-author:
Frédéric Rodrigo <fred.rodrigo@…> (13/03/2014 00:07:17)
git-committer:
Frédéric Rodrigo <fred.rodrigo@…> (13/03/2014 19:52:58)
Message:

Support filter empty column from CSV on Merge

File:
1 edited

Legend:

Unmodified
Added
Removed
  • analysers/Analyser_Merge.py

    rde441d1 raa65b36  
    551551        for k, v in csv_select.items(): 
    552552            if isinstance(v, list): 
    553                 where.append("%s IN ('%s')" % (k, "','".join(v))) 
     553                cond = "%s IN ('%s')" % (k, "','".join(filter(lambda i: i != None, v))) 
     554                if None in v: 
     555                    cond = "(" + cond + " OR %s IS NULL)" % k 
     556                where.append(cond) 
    554557            elif '%' in v: 
    555558                where.append("%s LIKE '%s'" % (k, v)) 
     559            elif v == None: 
     560                where.append("%s IS NULL" % k) 
    556561            else: 
    557562                where.append("%s = '%s'" % (k, v)) 
Note: See TracChangeset for help on using the changeset viewer.