1

I have a Weaviate instance running (ver 1.12.2)

I am playing around with the Python client https://weaviate-python-client.readthedocs.io/en/stable/ (ver 3.4.2) (add - retrieve - delete objects...etc...)

I have come across a weird bug when trying to update a data object.

I am following the example under the update() function at https://weaviate-python-client.readthedocs.io/en/stable/weaviate.data.html

I first add a data object

author_id = client.data_object.create(
    data_object = {'name': 'Philip Pullman', 'age': 64},
    class_name = 'Author'
)

I then retrieve it with client.data_object.get(author_id). This gives me a good output

{'class': 'Author',
 'creationTimeUnix': 1650911164482,
 'id': '00643310-bdd4-47b3-b404-d0aa7c9331f5',
 'lastUpdateTimeUnix': 1650911164482,
 'properties': {'age': 64, 'name': 'Philip Pullman'},
 'vectorWeights': None}

This works fine, but when I try to update the object with :

client.data_object.update(
    data_object = {'age': 74},
    class_name = 'Author',
    uuid = author_id
)

I get the following error:

---------------------------------------------------------------------------
UnexpectedStatusCodeException             Traceback (most recent call last)
<ipython-input-58-84003038f15b> in <module>
----> 1 client.data_object.update(
      2     data_object = {'age': 74},
      3     class_name = 'Author',
      4     uuid = author_id
      5 )

~/anaconda3/envs/tf_gpu_dev/lib/python3.8/site-packages/weaviate/data/crud_data.py in update(self, data_object, class_name, uuid, vector)
    246             # Successful merge
    247             return
--> 248         raise UnexpectedStatusCodeException("Update of the object not successful", response)
    249 
    250     def replace(self,

UnexpectedStatusCodeException: Update of the object not successful! Unexpected status code: 500, with response body: {'error': [{'message': 'repo: merge into index author: shard Iomjx2uCohtc: update vector index: insert doc id 1 to vector index: insert called with nil-vector'}]}

Moreover the annoying thing is that the update has been made in the background !

Running: client.data_object.get(author_id) again, gives the output:

{'class': 'Author',
 'creationTimeUnix': 1650911164482,
 'id': '00643310-bdd4-47b3-b404-d0aa7c9331f5',
 'lastUpdateTimeUnix': 1650911164482,
 'properties': {'age': 74, 'name': 'Philip Pullman'},
 'vectorWeights': None}

The 'age' field has been updated appropriately

Also.... shouldn't lastUpdateTimeUnix also be updated?

Thanks for reading my Q !

Billy.G
  • 71
  • 7
  • Going by ... https://github.com/semi-technologies/weaviate-python-client/blob/main/weaviate/data/crud_data.py. It looks like it doesn't like the response code it is getting. Its looking for a 204 status response...which it is not getting. I'm not familiar with these responses 200/204/404 so that's as far as I go – Billy.G Apr 27 '22 at 11:16
  • Thanks. The current assumption is that this is a bug when a vector index is configured, but an object has no vector attached. This combination was impossible up until recently. It seems that while creating and replacing works, patching creates an issue. We are tracking the bug here: https://github.com/semi-technologies/weaviate/issues/1936 – etiennedi Apr 29 '22 at 07:32
  • good stuff. I think this has been addressed. – Billy.G May 04 '22 at 18:21
  • Turned out to be a bug - it was addressed : https://github.com/semi-technologies/weaviate/issues/1936 – Billy.G May 04 '22 at 18:22
  • Correct, as soon as that fix goes live I will add an answer with some details and links to the version including the fix. – etiennedi May 05 '22 at 06:50

1 Answers1

0

I don't know if you solved this issue , but I think you might have deleted the data_object and so when you called update it says its unsuccessful because it has nothing to update.

Try to change it to this and see if it works:

client.data_object.create(
    data_object={"age": 74},
    class_name="Author",
    uuid=author_id)

Edit: I think you can also do create_update but I’m not sure.

Community
  • 1
  • 1
Yoxmo
  • 1
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 13 '23 at 05:29