I am trying to incrementally copy documents from one database to another.
Some fields contain date time values in the following format:
2016-09-22 00:00:00
while others are in this format:
2016-09-27 09:03:08.988
I extract and insert the documents like so:
pd.DataFrame(list(db_prod.db_name.collction_name.find({'_updated_at': {'$gt': last_added_timestamp}}).sort('_updated_at', 1)))
add = (df.to_dict('records'))try:db_incremental.other_db.collection_name.insert_many(add)
except BulkWriteError as bwe:print(bwe.details)
here is the error:
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line 684, in insert_manyblk.execute(self.write_concern.document)File "/usr/local/lib/python2.7/dist-packages/pymongo/bulk.py", line 470, in executereturn self.execute_command(sock_info, generator, write_concern)File "/usr/local/lib/python2.7/dist-packages/pymongo/bulk.py", line 302, in execute_commandrun.ops, True, self.collection.codec_options, bwc)File "pandas/tslib.pyx", line 663, in pandas.tslib._make_error_func.f (pandas/tslib.c:14736)
ValueError: NaTType does not support utcoffset
I dont actually need to modify the timestamps, just insert them as they are.
Any help appreciated.