question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: Somehow warn when passing the `_key` attribute to `initValues`

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
tariqdaoudacommented, Sep 26, 2018

My PhD defence is over. I am planning on releasing the current dev version tonight on pip!

1reaction
larsborncommented, Sep 27, 2018

@tariqdaouda congratulations man! I hope everything went well and that you are happy with the results!! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

SoapUI Feature Requests - SmartBear Community
Hi, I'm sending a POST request using SOAPUI free version and, I don't know why, in the request I see header's parameters duplicate....
Read more >
FIXatdl Online • FIX Trading Community v1.8
Parameter elements are identified by their “name” attribute. There is no limit to the number of parameters a strategy may have as long...
Read more >
C++ Tricks - Codeforces
I see lots of programmers write code like this one: pair<int, int> p; vector<int> v; // ... p = make_pair(3, 4); v.push_back(4); v.push_back(5);....
Read more >
Shared Memory Problem (unable to allocate ... - Ask TOM
If you do not fix this, your application is doomed to utter and total failure from day one. #2 -- I see the...
Read more >
Properties in more detail — qooxdoo 5.0.2 documentation
Init value in declaration¶. The preferred way for regular init values is to simply declare them by an init key in the property...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found