Open gglanzani opened 9 years ago
@gglanzani We'll take a look at this. I assume it's not related to the mochijson2
issue you reported in https://github.com/basho/riak-python-client/issues/395?
No, that issue seems to be related with an older version of mochijson2, while this one present itself only when I'm NOT using mochi
@gglanzani Sorry for the delay. Trying to understand your situation. So you are running your own, custom Erlang yearfun
on your nodes. You are getting the desired results in curl, but are only getting a partial result with the Python HTTP interface, right? And PBC seems to raise an exception in this case, right?
I'm looking at our current test cases and all of them seem to return a list values, not more complicated types like proplists. I could see that curl is simply blurping back whatever Erlang returns, but the Python client has to serialize and deserialize. As you can see from the PBC results, it's trying to convert it into a Python dict(), which is the source of the exception. I'm interested that the HTTP sort of works. I'm guessing it is unpacking part of the JSON we get back from Riak and throwing the rest on the floor.
So my guess at the moment is the Python client is only supporting returning a list of values. We could look at lists of dicts() as an enhancement.
Yes,you gave an accurate description of what (I think) is going on.
I think lists of dicts were fairly common but I see that some extra code is needed to make it work. Btw, curl converts [{grid1, year1}, {grid2 , year2}] to {grid1: year1, grid2: year2}, so some conversion is happening.
Is this difficult to fix?
@gglanzani I'll take a good to see how difficult it would be to add. Probably not too hard. Just have to prioritize it.
@javajolt At least it's in jira :stuck_out_tongue_winking_eye:
I have the following Erlang code (very simple, just for illustration)
When I run a MR code via CURL, I get
However when submitting with Python using http
I get
If, instead, I use
pbc
the client raises an exception
Am I doing something wrong, or…? Right now changing the Erlang code is the only fix: