Skip to content

Commit cb659b4

Browse files
committed
add forcePush argument to insert_all function
1 parent bf73d37 commit cb659b4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

databox/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ def push(self, key, value, date=None, attributes=None, unit=None):
105105

106106
return self.last_push_content['id']
107107

108-
def insert_all(self, rows):
109-
self.last_push_content = self._push_json({
108+
def insert_all(self, rows, forcePush=None):
109+
payload = {
110110
'data': [self.process_kpi(**row) for row in rows]
111-
})
111+
}
112+
113+
if isinstance(forcePush, bool) and forcePush:
114+
payload['meta'] = {'ensure_unique': True}
115+
self.last_push_content = self._push_json(payload)
116+
112117
return self.last_push_content['id']
113118

114119
def last_push(self, number=1):

0 commit comments

Comments
 (0)