Traceback (most recent call last):
File "play.py", line 22, in <module>
table.insert_or_replace(doc=document_to_save)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 206, in call
return attempt.get(self._wrap_exception)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/six.py", line 703, in reraise
raise value
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/mapr/ojai/storage/OJAIDocumentStore.py", line 252, in insert_or_replace
operation_type='INSERT_OR_REPLACE')
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 49, in wrapped_f
return Retrying(*dargs, **dkw).call(f, *args, **kw)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 206, in call
return attempt.get(self._wrap_exception)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 247, in get
six.reraise(self.value[0], self.value[1], self.value[2])
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/six.py", line 703, in reraise
raise value
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/retrying.py", line 200, in call
attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/mapr/ojai/storage/OJAIDocumentStore.py", line 245, in __evaluate_doc
self.validate_response(response=response)
File "/home/mapr/.conda/envs/mapr_streaming/lib/python3.7/site-packages/mapr/ojai/storage/OJAIDocumentStore.py", line 432, in validate_response
raise DecodingError(m=response.error.error_message)
mapr.ojai.exceptions.DecodingError.DecodingError: Encountered FIELD_NAME while looking for end object token.
My full code is
from mapr.ojai.storage.ConnectionFactory import ConnectionFactory
connection_string = "localhost:5678?auth=basic;user=mapr;password=mapr;ssl=false;"
connection = ConnectionFactory.get_connection(connection_str=connection_string)
def get_or_create(name):
# Get a store and assign it as a DocumentStore object
if connection.is_store_exists(store_path=f'/apps/{name}'):
table = connection.get_store(store_path=f'/apps/{name}')
else:
table = connection.create_store(store_path=f'/apps/{name}')
return table
elem = {"a": 0, "b": {"c": "d"}}
msg = {'_id' : 'vskjhg', 'elems': [elem]}
document_to_save = connection.new_document(dictionary=msg)
print(str(document_to_save.as_json_str()))
table = get_or_create('find_errors')
table.insert_or_replace(doc=document_to_save)
The object output by the print is below, it seems to have added an extra "$numberLong": 0 in the most nested dictionary
{"_id": "vskjhg", "elems": [{"a": {"$numberLong": 0}, "b": {"$numberLong": 0, "c": "d"}}]}
When trying to add the following record:
it is generating the following error:
My full code is
The object output by the
print
is below, it seems to have added an extra"$numberLong": 0
in the most nested dictionary{"_id": "vskjhg", "elems": [{"a": {"$numberLong": 0}, "b": {"$numberLong": 0, "c": "d"}}]}