コード例 #1
0
ファイル: deltas.py プロジェクト: VertNet/Darwin-Core-Engine
 def __init__(self, conn, options):
     self.conn = conn
     self.options = options
     self.updatesql = 'update cache set rechash=?, recjson=?, recstate=? where reckey=?'
     self.deltasql = 'SELECT c.reckey, t.rechash, t.recjson FROM tmp as t, cache as c WHERE t.reckey = c.reckey AND t.rechash <> c.rechash'        
     f = codecs.open(self.options.csv_file, encoding='utf-8', mode='r')
     reader = UnicodeDictReader(f, skipinitialspace=True)
     columns = [x.lower() for x in reader.next().keys()]            
コード例 #2
0
ファイル: deltas.py プロジェクト: VertNet/Darwin-Core-Engine
 def __init__(self, conn, options):
     self.conn = conn
     self.options = options
     self.insertsql = 'insert into cache values (?, ?, ?, ?)' 
     self.deltasql = "SELECT * FROM tmp LEFT OUTER JOIN cache USING (reckey) WHERE cache.reckey is null"
     self.deltasql_deleted = "SELECT * FROM tmp LEFT OUTER JOIN cache USING (reckey) WHERE cache.reckey is not null and cache.recstate = 'deleted'"
     self.totalcount = 0
     f = codecs.open(self.options.csv_file, encoding='utf-8', mode='r')
     reader = UnicodeDictReader(f, skipinitialspace=True)
     columns = [x.lower() for x in reader.next().keys()]