Skip to content

Commit

Permalink
add forcePush argument to insert_all function
Browse files Browse the repository at this point in the history
  • Loading branch information
VladaPetrovic committed Oct 7, 2018
1 parent bf73d37 commit cb659b4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions databox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,15 @@ def push(self, key, value, date=None, attributes=None, unit=None):

return self.last_push_content['id']

def insert_all(self, rows):
self.last_push_content = self._push_json({
def insert_all(self, rows, forcePush=None):
payload = {
'data': [self.process_kpi(**row) for row in rows]
})
}

if isinstance(forcePush, bool) and forcePush:
payload['meta'] = {'ensure_unique': True}
self.last_push_content = self._push_json(payload)

return self.last_push_content['id']

def last_push(self, number=1):
Expand Down

0 comments on commit cb659b4

Please sign in to comment.