Releases: typedb/typedb-driver-python
TypeDB Client Python 2.1.0
PyPI package: https://pypi.org/project/typedb-client
Documentation: https://docs.vaticle.com/docs/client-api/python
Distribution
Available through https://pypi.org
pip install typedb-client==2.1.0
New Features
- Rename batch_size option to prefetch_size
The optionbatch_size
was misleading as we generally use 'batch' to refer to all of the messages sent by a peer (server or client) within a set time window (eg: 1ms). So we renamed it toprefetch_size
.
Bugs Fixed
- Fault-tolerant Cluster database operations
We improved the fault tolerance of our Cluster database operations, namely Create, Contains and Delete.
Code Refactors
Other Improvements
- Adjust Cluster discovery logging
Print logs on cluster discovery before the actual discovery happens (and has a chance to fail) such that passing invalid cluster address is easier to debug.
Grakn Client Python 2.0.1
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.1
New Features
- Encode request IDs as bytes and make is_inferred a Local Thing method
Previously the ID of a transaction request was stored as a string, which is an inefficient representation of a UUID. We've changed it to bytes.
Also,is_inferred
is now a Local method onThing
.
Bugs Fixed
Code Refactors
Other Improvements
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0
New Features
-
Implement explanations
Following typedb/typedb#6271 and the corresponding protocol change in typedb/typedb-protocol#131 we implement Explanations, Explainable concept maps, and the explain() query API, which allows users to stream Explanations on demand note: explain query or transaction option must be set totrue
-
Set default parallelism of CoreClient to 2
Given that Python doesn't provide an easy way of getting the number of CPUs available to the process, we decided to reduce the default parallelism of CoreClient from 3 to 2. This should ensure it continues to run smoothly on systems with fewer cores. -
Add prefetch, session, schema lock timeout options
We added three newGraknOptions
:prefetch
,session_idle_timeout_millis
andschema_lock_acquire_timeout_millis
.
Bugs Fixed
-
Fix test-deployment
API changes broke test-deployment, so we updated it. -
On transaction failover, transfer options to the new session
Previously, when opening a Transaction to Grakn Cluster failed (causing a new Session to be opened to a new server), the old Session options were discarded. Now, we properly transfer the Session-level options to the new session.
Code Refactors
-
Shorten enum names to SessionType, TransactionType
While aligning Client Python with Client Java, we introducedGraknTransaction.Type
andGraknSession.Type
. But in Python these proved cumbersome to type out. So we reverted them toSessionType
andTransactionType
. -
Architecture refactor
We have refactored Client Python considerably to come up with an architecture that is easy to understand, easy to extend, and easy to replicate in other languages that wish to implement a Grakn Client.
This is a breaking change. The updated APIs are:
Create a Grakn Core client
client = Grakn.core_client(address="localhost:1729")
Create a Grakn Cluster client
client = Grakn.cluster_client(addresses=["127.0.0.1:11729:11730", "127.0.0.1:21729:21730", "127.0.0.1:31729:31730"])
Retrieve a Type's Label as a string
label = type.get_label().name()
Retrieve answer of Graql Match Aggregate query
count = tx.query().match_aggregate(query).get()
Get all roles currently played by a Thing (was previously called get_plays
)
roleTypes = thing.as_remote(tx).get_playing()
For full details of this rework, please see typedb/typedb-driver#302 .
Other Improvements
- Upgrade grpcio to 1.36.1, protobuf to 3.15.5
We upgraded grpcio and protobuf to remove warnings when running Python 3.9.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-10
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-10
New Features
- Add 'get_type' to local Thing concepts
Previously,get_type
was only available on remoteThing
concepts. Now, we include type information whenever a Graql query or Concept API method returns aThing
, enabling users to use it without an additional network roundtrip per concept.
Bugs Fixed
Code Refactors
- Introduce terms: 'internal' and 'external' address
For clarity we deleted the Grakn Cluster terms "client address" and "server address", and they are now named "internal" and "external", representing a server-to-server address and a server-to-client address.
Other Improvements
- Update grakn artifacts
We updated the Grakn artifacts used in tests.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-9
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-9
New Features
-
**Add parallel option **
We allow client-java to set the parallelism of the server explicitly (useful in conjunction with traceInference, which is effective only with no parallelism) -
Store more complete cluster address information
We now store both "client address" and "server address". The former is the address that the client will use when connecting to the cluster, whereas the latter is the address that a cluster member use to talk to its peers.
Bugs Fixed
- Fix possible ValueError when closing a session
We patched a flaw where very occasionally,Session.close
would throw aValueError
if a pulse was in flight.
Code Refactors
Other Improvements
- Fix Cluster failover test intermittently being too slow and failing
Our Cluster failover test was intermittently failing if Grakn Cluster failed to start in time. We now uselsof
to detect when all 3 of the allocated ports are in use.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-8
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-8
New Features
-
When closing a client, also close all its sessions
Theclose
method ofGraknClient
now automatically closes allSession
objects that were opened from that client. -
Use self-hosted Bazel cache
Speed up CI by using self-hosted remote Bazel cache -
Add option to enable inference tracing
We introduce a new option to allow tracing the internals of Grakn's reasoner. -
Expose replica info when getting Cluster databases
We now expose additional information when fetching databases in Cluster. The database name, server address, primary/secondary state, and term number are all available.
This is a breaking change.client.databases().all()
now returnsList[Database]
(previously it wasList[str]
). To get the old functionality (listing the names), use[db.name() for db in client.databases().all()]
.
Additionally,client.databases().delete()
has been deleted, and superseded by the new syntax:client.databases().get(name).delete()
.
Bugs Fixed
-
Fix tests using wrong method to check db existence
Our tests were using the syntax:if "grakn" in client.databases().all()
which no longer works, becauseall()
now returnsDatabase
objects, not strings. We updated them to the new syntax:if client.databases().contains("grakn")
. -
Raise StopIteration when iterating over an already-completed Stream
Previously, iterating over an already-completed Stream would stall. Now, we instead raise aStopIteration
error.
Code Refactors
Other Improvements
- Fix error in test-deployment-pip
There was an error in test-deployment-pip caused by old syntax, which we fixed.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-7
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-7
New Features
Bugs Fixed
Code Refactors
Other Improvements
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-6
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-6
New Features
-
Support new graql update queries
We synchronised client-python with the current master versions of protocol, behavioural tests, and grakn core server, to enable support for the new update query type, as well as adding support for related tests and automation. -
Improve Cluster failover algorithm and add a test for it
We wrote a test for Grakn Cluster failover. Using the test, we improved our failover algorithm, fixing bugs and making it more readable. -
Grakn Cluster integration
We now support connecting to Grakn Cluster.
This is a breaking change. Creating aGraknClient
now requires a new syntax:client = GraknClient.core(address)
To connect to Grakn Cluster, use
client = GraknClient.cluster(address)
The API usage of a Cluster client is the same as for a Core client. It also supports one additional field in
GraknOptions
namedallow_secondary_replica
, which when set toTrue
allows read transactions to read from secondary database replicas. -
Add ability to retrieve all rules
Since Rule was refactored in Grakn 2.0 to no longer be a subtype of Concept, we lost the ability to retrieve all rules usingmatch $x sub rule; get;
.
So, to allow the user to retrieve all rules, we now addget_rules
to theLogicManager
, enabling use oftx().logic().get_rules()
.
Bugs Fixed
-
Fix 5 second delay before programs using the client actually terminate
There was a 5 second delay before programs using Client Python actually terminated, caused by a worker thread staying alive for 5 seconds after closing a Session. We changed the thread to a daemon thread, that does not block the program's termination. -
Make private concept API method public
We fixed the issue withget_thing_type
API not being available for the user. -
Make behaviour tests rerunnable on developer's machine
Fix rerunning behavioural tests for second time on developers' machines -
Create one gRPC Channel per session and transaction
We observed that when using 2 parallel threads to open a large number of transactions, response messages from the server would be intermittently dropped, leading to the client stalling. Creating a separate gRPC Channel for each transaction appears to solve the issue. -
Fix console warnings caused by out of date dependency
FixWARNING: An illegal reflective access operation has occurred
warning caused by an out of date version of protobuf.
Code Refactors
-
Remove dependency on six library
As Grakn Client Python is a Python 3-only library, we no longer need to depend onsix
library (which is a compatibility layer between Python 2 and Python 3) and therefore it needs to be removed for better code maintainability and understandability. -
Update dependency on grakn-protocol
Depend on Grakn Protocol package by the new namegrakn-protocol
(consistent across all platforms)What are the changes implemented in this PR?
typedb/typedb-protocol#106 renamed Protocol package deployed to PyPI to
grakn-protocol
. In this PR dependency is upgraded to latestsnapshot
version ofgrakn-protocol
.
Other Improvements
-
Reenable remote build caching
Speed up builds by utilizing remote caching provided by BuildBuddy. -
Upgrade grpcio to 1.35.0
Our older version of grpcio was not being successfully installed on all systems. To mitigate these installation issues we upgraded to 1.35.0. -
Update dependencies and the version
We have updatedgrakn-protocol
to2.0.0a6
. Additionally, we've updated the version to2.0.0-alpha-6
.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-5
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client=={version}
New Features
Bugs Fixed
Code Refactors
Other Improvements
-
Add BDD to CI and create pip deployment test
Our test suite was not being run in CI and could only be triggered manually by ourselves. In order to get them to work in CI, we needed them to fetch, unzip and run Grakn in the background. So we implemented that and added the tests to CI.
We also didn't have an automated mechanism for verifying that ourpip
deployment produced a working Client Python artifact that could be used to make Graql queries, so we createdtest-deployment-pip
. -
BDD: Graql Steps
We had Connection and Concept BDD implementations, but Graql steps were still not implemented. We added support for them. -
Update automation.yml to include
behaviour
dependency
Following #154 PR, dependency analysis showed thatbehaviour
repo is not defined in dependencies of automation.yml -
Update automation.yml to include
release
dependency forcommon
Re-add 'release' to 'common' dependency, since dependency-analysis is supporting tags now. -
Add more BDD infrastructure and support more features
Our previous BDD infrastructure only supported a very limited set of features. We expanded it to include more features, such as the Concept API. -
Bump year in license headers to 2021
License headers are currently out of date (2020) for a while. This PR replaces 2020 with 2021 across all the files.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.
Grakn Client Python 2.0.0-alpha-4
PyPI package: https://pypi.org/project/grakn-client
Documentation: https://dev.docs.grakn.ai/docs/client-api/python
Distribution
Available through https://pypi.org
pip install grakn-client==2.0.0-alpha-4
New Features
- RPC implementation for sending match aggregate, match group, and match group aggregate queries
We have implemented RPC support for sending match aggregate, match group, and match group aggregate queries to the server.
Please refer to full release notes of 2.0.0-alpha to see the changes contained in 2.0.0.