Search code examples
pythongraphdatastax-enterprise-graph

dse graph python - No such property: g for class: error


I am new to dse graph. I am getting an error

No such property: g for class: error

what could I be doing wrong?

>>> from dse.cluster import Cluster, EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT, GraphExecutionProfile
>>> from dse.graph import GraphOptions
>>> from dse.auth import PlainTextAuthProvider
>>> Auth_provider = PlainTextAuthProvider(username=<<username>>,
    password=<<password>>)
>>> ep = GraphExecutionProfile(graph_options=GraphOptions(graph_name='idg'))
>>> cluster = Cluster(database_cluster, auth_provider=auth_provider,
     execution_profiles={EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT: ep})
>>> dse_session.execute_graph('g.V()')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "dse/cluster.py", line 2017, in dse.cluster.Session.execute_graph
  File "dse/cluster.py", line 3962, in dse.cluster.ResponseFuture.result
dse.InvalidRequest: Error from server: code=2200 [Invalid query] message="No such property: g for class: Script184"

>>> print(vars(ep.graph_options))
{'_graph_options': {'graph-name': b'idg', 'graph-source': b'g', 'graph-language': b'gremlin-groovy', 'graph-results': b'graphson-1.0'}}

Solution

  • Instead of the EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT when defining execution profile you need to use EXEC_PROFILE_GRAPH_DEFAULT. The EXEC_PROFILE_GRAPH_SYSTEM_DEFAULT is used to access to System API to manipulate graphs, etc.

    You also need to connect to cluster via session = cluster.connect() (I don't see it in your code).

    See driver docs for more examples.