Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Releases: typedb/typedb-driver-python

TypeDB Client Python 2.1.0

20 May 14:05
Compare
Choose a tag to compare

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 option batch_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 to prefetch_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

13 Apr 19:07
816a88d
Compare
Choose a tag to compare

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 on Thing.

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

31 Mar 15:07
6c6b364
Compare
Choose a tag to compare

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 to true

  • 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 new GraknOptions: prefetch, session_idle_timeout_millis and schema_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 introduced GraknTransaction.Type and GraknSession.Type. But in Python these proved cumbersome to type out. So we reverted them to SessionType and TransactionType.

  • 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

05 Mar 21:29
5208548
Compare
Choose a tag to compare

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 remote Thing concepts. Now, we include type information whenever a Graql query or Concept API method returns a Thing, 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

03 Mar 18:46
1866beb
Compare
Choose a tag to compare

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 a ValueError 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 use lsof 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

23 Feb 19:34
4e022fe
Compare
Choose a tag to compare

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
    The close method of GraknClient now automatically closes all Session 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 returns List[Database] (previously it was List[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, because all() now returns Database 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 a StopIteration 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

14 Feb 15:47
147ae7f
Compare
Choose a tag to compare

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

05 Feb 00:00
Compare
Choose a tag to compare

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 a GraknClient 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 named allow_secondary_replica, which when set to True 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 using match $x sub rule; get;.
    So, to allow the user to retrieve all rules, we now add get_rules to the LogicManager, enabling use of tx().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 with get_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
    Fix WARNING: 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 on six 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 name grakn-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 latest snapshot version of grakn-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 updated grakn-protocol to 2.0.0a6. Additionally, we've updated the version to 2.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

18 Jan 17:51
ff9e7a1
Compare
Choose a tag to compare

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 our pip deployment produced a working Client Python artifact that could be used to make Graql queries, so we created test-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 that behaviour repo is not defined in dependencies of automation.yml

  • Update automation.yml to include release dependency for common
    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

08 Jan 11:19
60e324d
Compare
Choose a tag to compare

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.