Closed JonThom closed 2 years ago
@JonThom thank you for reporting it! The correct way to make a query would be:
client = GraknClient(uri="localhost:48555")
from grakn.client import GraknClient
with client.session(keyspace="socialnetwork") as session:
with session.transaction().read() as read_transaction:
answer_iterator = read_transaction.query("match $x sub person; get; limit 1;")
I've raised the issue on docs being invalid in this case: graknlabs/docs#334
@vmax possibly related, re: local and remote concept API
after upgrading Grakn and the Python grakn-client (v 1.8.x), I prepended the .as_remote(tx)
method to some non-local concept method calls, e.g.:
dict_roleplayers = rel.as_remote(read_transaction).role_players_map()
However, for most concept API methods, this led to an exception:
File "/Applications/anaconda3/envs/grakn-new/lib/python3.7/site-packages/grakn/service/Session/Concept/RemoteConcept.py", line 525, in role_players_map pairs = list(map(to_pair, self._tx_service.run_concept_iter_method(self.id, role_players_map_req))) AttributeError: 'Transaction' object has no attribute 'run_concept_iter_method'
In fact, in my code, the .as_remote() method only seems to work for the .playing(), .sup() and .roles() methods (all type
methods) . All other concept methods in my code have to be executed on local objects.
I imagine you might have an idea of what is going wrong and could log the issue with more relevant background information. Otherwise I'm happy to log it.
@adammitchelldev this might be something for you to look into after your refactor to support async?
We have just released https://github.com/graknlabs/client-python/releases/tag/2.0.0-alpha - it is very likely that the issue is resolved. The code architecture has been overhauled.
As execute
no longer exists in TypeDB Clients, this issue has gone away.
Description
In Python client API, .transaction.execute() produces the error
AttributeError: 'Transaction' object has no attribute 'execute'
Environment
Reproducible Steps
in terminal:
in Python:
Expected Output
Expected answer_iterator to be an iterator yielding the 'person' type
Actual Output
Additional info