PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client
Or you can upgrade your local installation with:
pip install -U grakn-client
New Features
- **Introduce further Query Options.**
We introduce modified `infer`, and new `batch_size`, and `explain` options for queries:
Transaction.query("...",
infer=Transaction.Options.SERVER_DEFAULT,
explain=Transaction.Options.SERVER_DEFAULT,
batch_size=Transaction.Options.SERVER_DEFAULT)
The default `SERVER_DEFAULT` value means that the server will automatically choose the default value for `infer`, `explain`, and `batch_size`. For reference, the server will default to `infer = True`, `explain = True`, and `batch_size = 50`.
** use `explain=true` if you want to retrieve explanations from your query ** This was introduced to ensure correct Explanations, without blowing up Transaction memory when not required.
- **Add future-style get for explicit waiting and error handling.**
Since the introduction of asynchronous query processing, the error handling model has become less clear, as an error could be picked up on a line unrelated to its corresponding query. In order to allow clients to explicitly consume query completion, a `get()` method is added to the query result (iterator) which will block until the results are received, or throw an exception on error.
Clients looking to benefit from the asynchronous processing can continue without using the `get()` syntax.
- **Add Explanation.get_rule().**
The `Rule` that corresponds to an explanation is now being returned in the protocol responses, but the python `Explanation` object does not record it. This PR records it if the rule is valid, else sets it to None.
Bugs Fixed
- **Fix explanation throwing an exception.**
A bug was introduced with local concepts that made it impossible to fetch explanations.
Code Refactors
- **Remove implicit, rename date to datetime, rename datatype to valuetype.**
This Change synchronises with changes in Grakn Core (https://github.com/graknlabs/grakn/pull/5722) that remove implicit types, and also updates to no longer use `date`, but instead use `datetime` (including a protocol update). Finally, we also propagate the change from `datatype` to `valuetype.
Other Improvements