Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verify client version. #148

Merged
merged 3 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 1 addition & 20 deletions example/GraphClientSimpleExample.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from nebula2.gclient.net import ConnectionPool
from nebula2.Config import Config
from nebula2.common import *
from FormatResp import print_resp

if __name__ == '__main__':
Expand Down Expand Up @@ -53,28 +52,10 @@
assert resp.is_succeeded(), resp.error_msg()
print_resp(resp)

bval = ttypes.Value()
bval.set_bVal(True)
ival = ttypes.Value()
ival.set_iVal(3)
sval = ttypes.Value()
sval.set_sVal("Cypher Parameter")
params={"p1":ival,"p2":bval,"p3":sval}

# test parameter interface
resp = client.execute_parameter('RETURN abs($p1)+3, toBoolean($p2) and false, toLower($p3)+1',params)
assert resp.is_succeeded(), resp.error_msg()
print_resp(resp)
# test compatibility
resp = client.execute('RETURN 3')
resp = client.execute('FETCH PROP ON like "Bob"->"Lily"')
assert resp.is_succeeded(), resp.error_msg()
print_resp(resp)

# get the result in json format
resp_json = client.execute_json_with_parameter("yield 1", params)
json_obj = json.loads(resp_json)
print(json.dumps(json_obj, indent=2, sort_keys=True))

# drop space
resp = client.execute('DROP SPACE test')
assert resp.is_succeeded(), resp.error_msg()
Expand Down
3 changes: 3 additions & 0 deletions nebula2/Exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ def __init__(self, code=E_UNKNOWN, message=None):
self.type = code
self.message = message

class ClientServerIncompatibleException(Exception):
def __init__(self, message):
Exception.__init__(self, f'Current client is not compatible with the remote server, please check the version: {message}')
4 changes: 3 additions & 1 deletion nebula2/common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@



from .ttypes import UTF8STRINGS, NullType, ErrorCode, SchemaID, Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Tag, Vertex, Edge, Step, Path, HostAddr, KeyValue, LogInfo, DirInfo, NodeInfo, PartitionBackupInfo, CheckpointInfo, GraphSpaceID, PartitionID, TagID, EdgeType, EdgeRanking, LogID, TermID, Timestamp, IndexID, Port, SessionID, ExecutionPlanID
from .ttypes import UTF8STRINGS, NullType, ErrorCode, SchemaID, Date, Time, DateTime, Value, NList, NMap, NSet, Row, DataSet, Geography, Tag, Vertex, Edge, Step, Path, HostAddr, KeyValue, LogInfo, DirInfo, NodeInfo, PartitionBackupInfo, CheckpointInfo, GraphSpaceID, PartitionID, TagID, EdgeType, EdgeRanking, LogID, TermID, Timestamp, IndexID, Port, SessionID, ExecutionPlanID

version = "2.6.0"

Loading