Beispiel #1
0
def update(key, q):
    seen = set()
    for field, value in add_to_indexes(q):
        vars = {'key': key, 'value': value }
        if (field, value) in seen:
            print (key, field, value)
            print seen
            print q
        if (field, value) in seen:
            continue
        seen.add((field, value))
        cur.execute('insert into ' + field + ' (k, v) values (%(key)s, %(value)s)', vars)
Beispiel #2
0
def update(key, q):
    seen = set()
    for field, value in add_to_indexes(q):
        vars = {'key': key, 'value': value }
        if (field, value) in seen:
            print (key, field, value)
            print seen
            print q
        if (field, value) in seen:
            continue
        seen.add((field, value))
#        cur.execute('select * from ' + field + ' where key=%(key)s and value=%(value)s', vars)
#        if len(cur.fetchall()) != 0:
#            print "key dup: key=%s, value=%s" % (key, value)
#            print q
#            continue
        cur.execute('insert into ' + field + ' (k, v) values (%(key)s, %(value)s)', vars)
Beispiel #3
0
def update(key, q):
    seen = set()
    for field, value in add_to_indexes(q):
        vars = {'key': key, 'value': value}
        if (field, value) in seen:
            print(key, field, value)
            print seen
            print q
        if (field, value) in seen:
            continue
        seen.add((field, value))
        #        cur.execute('select * from ' + field + ' where key=%(key)s and value=%(value)s', vars)
        #        if len(cur.fetchall()) != 0:
        #            print "key dup: key=%s, value=%s" % (key, value)
        #            print q
        #            continue
        cur.execute(
            'insert into ' + field + ' (k, v) values (%(key)s, %(value)s)',
            vars)