def insert(self, samples):
try:
outdated = Stats.insert((id, dateparse.parse_datetime(dt), value) for id, dt, value in samples)
except db.IntegrityError:
log.error("Duplicate stats insert: " + db.connection.queries[-1]['sql'])
db.transaction.rollback() # allow future stats to still work
except:
log.error("Error handling stats insert: " + traceback.format_exc())
else:
if outdated:
log.warn("Outdated samples ignored: {0}".format(outdated))
评论列表
文章目录