sqlite 去重

lst = ['DTS2323','DTS2343','DTS123']
con = sqlite3.connect(db)
sql1 = ' delete from alpm_dtsinfo where rowid not in(select max(rowid) from alpm_dtsinfo group by name) '
sql = "delete from alpm_dtsinfo where name in (%s)"%("'"+"','".join(lst)+"'")
cursor = con.cursor()

cursor.execute(sql1)
cursor.execute(sql)
con.commit()
print cursor.fetchall()

con.close()


cursor = con.cursor()
sql = "select name1 from alpm_dtsinfo where rank=9"
# cursor.execute(sql1)
cursor.execute(sql)
con.commit()
configstr = cursor.fetchone()[0].strip()

con.close()

print type(configstr)
print configstr
jsondata = json.loads(configstr)

print jsondata['alonGroup']['users']
posted @ 2017-01-18 20:52  aloneOnWorld  阅读(1932)  评论(0编辑  收藏  举报