Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add support for Cached Queries #102
I've run into some hiccups on this issue, and I'd like to ask a few clarifying questions.
First, what I've noticed so far
I can fix the creation issue easily enough, but the docs are inconsistent enough with regards to the update endpoint that I'm not sure whether I should be building a new method or updating the gem docs (and suggesting that the Keen.io docs get updated).
If I can figure out these questions, I'm happy to build out this set of methods and update the docs to be complete and accurate.
@myrridin good questions! I used to be more familiar with this code, but I need to do some digging first. This is what I do know:
On the API level, the API reference is correct when it says:
It's not the most elegant "update," but the SDK might be able to make it a bit easier to deal with. I know we have talked about this for other SDKs, but I am not sure which ones have it implemented.
Let me look into a few things and get back to you with better answers for your questions.
Another note before I have more answers, the way the Python client works with Saved and Cached Queries is nice: https://github.com/keenlabs/KeenClient-Python#saved-queries
My expectation is that the README.md documentation is incorrect, and full updates are required from the API's point of view. This should not be too difficult to abstract away in the SDK, then the docs can be updated to reflect the actual behavior (and the new behavior of update_full, mimicking the python lib).
One of the difficulties here is writing tests. The integration test suite seems to depend on a certain set of data, and does not seem to seed that data from what I can tell. It's obvious why the keys for your integration project are no longer part of the repo, but finding a way to make running and writing integration tests a little easier for contributors could go a long way towards the stability of actual API interactions.
I think it might be good to have a helper that can clear out a project, and seed appropriate data for the integration suite. I have to think about this more, but once I've written this functionality I'm not sure I'll be able to thoroughly evaluate it outside of an IRB session. Given that neither create nor update are currently working it's probably not a huge problem, but I'd love to have a way to ensure this is working properly going forward.
I appreciate you sending along the questions. I think there's a lot of opportunity to enhance this area of the SDK, and perhaps even the overall contributor experience.
Hey @myrridin - sorry it has taken so long to get back to you!
It looks like all of your assumptions in the first paragraph are correct.
As for tests, I see what you mean about how it is looking for a specific set of data yet isn't creating it for you. Definitely not ideal. Sadly, I am not even sure what that set of data is anymore. I'm going to do some digging to see if I can find it, but it looks like it has been a while.
Is there anything I haven't touched on that is blocking you? I'll focus on the most important first.