vesoft-inc / nebula-python

Client API of Nebula Graph in Python
194 stars 76 forks source link

storage-client property mismatch #218

Closed wey-gu closed 1 year ago

wey-gu commented 2 years ago

client: 3.1.0 server: 3.1.0

With storage client, it's showing player.name value as vid(incorrect) and player.age value as player.name(incorrect)

In [24]: resp = graph_storage_client.scan_vertex(
    ...:         space_name='basketballplayer',
    ...:         tag_name='player')

In [25]: while resp.has_next():
    ...:     result = resp.next()
    ...:     for vertex_data in result:
    ...:         print(vertex_data)

In [26]: vertex_data
Out[26]: ("player136" :player{name: "player136", age: "Steve Nash"})
                                    ^^^^^^^^^^         ^^^^^^^^^^^

In [3]: vertex_data.as_node().prop_names("player")
Out[3]: ['name', 'age']

In [4]: vertex_data.as_node().prop_values("player")
Out[4]: ["player138", "Paul Gasol"]

We could tell the actual value with graph client:

In [30]: from nebula3.gclient.net import ConnectionPool
    ...: from nebula3.Config import Config
    ...: # define a config
    ...: config = Config()
    ...: config.max_connection_pool_size = 10
    ...: # init connection pool
    ...: connection_pool = ConnectionPool()
    ...: # if the given servers are ok, return true, else return false
    ...: ok = connection_pool.init([('graphd', 9669)], config)
    ...: session = connection_pool.get_session('root', 'nebula')
    ...:
    ...: # select space
    ...: r = session.execute('USE basketballplayer;MATCH(v:player) RETURN v;')

In [31]: r.rows()
Out[31]:
[Row(
     values=[Value(
         vVal=Vertex(
              vid=Value(
                  sVal=b'player127'),
              tags=[Tag(
                  name=b'player',
                  props={b'age': Value(
                      iVal=42), b'name': Value(
                      sVal=b'Vince Carter')})]))]),

ref



In [6]: !pip freeze | grep nebula

nebula3-python==3.1.0

In [8]: r = session.execute('show hosts')

In [9]: r
Out[9]: ResultSet(keys: ['Host', 'Port', 'HTTP port', 'Status', 'Leader count', 'Leader distribution', 'Partition distribution', 'Version'], values: ["storaged0", 9779, 19669, "ONLINE", 3, "basketballplayer:3", "basketballplayer:3", "3.1.0"],["storaged1", 9779, 19669, "ONLINE", 3, "basketballplayer:3", "basketballplayer:3", "3.1.0"],["storaged2", 9779, 19669, "ONLINE", 4, "basketballplayer:4", "basketballplayer:4", 

"3.1.0"])
wey-gu commented 2 years ago

@Aiee shall we tag a new release now as more are encountering this issue

https://discuss.nebula-graph.com.cn/t/topic/9846/3?u=wey

wey-gu commented 2 years ago

Reopen it, will close when new release is made. (Fix merged in master already)

Aiee commented 2 years ago

@Aiee shall we tag a new release now as more are encountering this issue

https://discuss.nebula-graph.com.cn/t/topic/9846/3?u=wey

Yeah, please remind me about this when there is a new release of NebulaGraph.

wey-gu commented 1 year ago

closing this as a new release including its fix was made.