Suggestion: Somehow warn when passing the `_key` attribute to `initValues`
See original GitHub issueI just started to use this Python client for ArangoDB and - stupidly - stumbled into a pitfall. I wanted to set a custom key for my documents and set it via _key
of the dictionary passed to initValues
of createDocument
. I understand that ArangoDB client should ignore all attributed starting with an underscore (because they are supposed to be used by Arango internally) so the behavior of ignoring the value I passed is probably intentional.
My solution was, to change this
json_data = {'foo': 'bar'}
json_data['_key'] = 'your_key'
doc = connection['your_database']['your_collection'].createDocument(initValues=json_data)
doc.save()
to this
json_data = {'foo': 'bar'}
doc = connection['your_database']['your_collection'].createDocument(initValues=json_data)
doc._key = 'your_key'
doc.save()
I would greatly have appreciated a warning in the first code snippet above though. Another option would of course be to make an exception for the dictionary entry _key
and just set the value in the document. _key
is somehow different from other internal properties since it occasionally is set manually.
What do you think?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
My PhD defence is over. I am planning on releasing the current dev version tonight on pip!
@tariqdaouda congratulations man! I hope everything went well and that you are happy with the results!! 😃