Skip to content

Commit c21ef4a

Browse files
committed
Insert/upsert fix
1 parent 07b2091 commit c21ef4a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

hdx/data/resource.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,14 +217,14 @@ def create_datastore(self, schema: List[dict] = None, primary_key: Optional[str]
217217
chunksize = 10000
218218
offset = 0
219219
if primary_key is None:
220-
datastore_function = 'datastore_insert'
220+
method = 'insert'
221221
else:
222-
datastore_function = 'datastore_upsert'
222+
method = 'upsert'
223223
logger.debug('Uploading data from %s to datastore' % url)
224224
while offset < len(rows):
225225
rowset = rows[offset:offset + chunksize]
226-
data = {'resource_id': self.data['id'], 'force': True, 'method': 'upsert', 'records': rowset}
227-
self._write_to_hdx(datastore_function, data, 'id')
226+
data = {'resource_id': self.data['id'], 'force': True, 'method': method, 'records': rowset}
227+
self._write_to_hdx('datastore_upsert', data, 'id')
228228
offset += chunksize
229229
logger.debug('Uploading: %s' % offset)
230230
except Exception as e:

0 commit comments

Comments
 (0)