-
Notifications
You must be signed in to change notification settings - Fork 71
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
nebula-go 3.4.0 query nothing from nebula server 3.4.1 #264
Comments
Could you provide how this "can not query anything" looks like? I guess something is wrong. The nebula-console is based on nebula-go, you should verify quite easily actually that 3.4.0 works fine. Thanks! |
thanks for reply. I will supply my code snippet to reproduce the problem. |
my nebula server info:
|
go code: /*
* Copyright (c) 2021 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License.
*
*/
package main
import (
"fmt"
nebula "github.com/vesoft-inc/nebula-go/v3"
)
const (
address = "124.222.227.15"
// The default port of NebulaGraph 2.x is 9669.
// 3699 is only for testing.
port = 9669
username = "root"
password = "nebula"
)
// Initialize logger
var log = nebula.DefaultLogger{}
func main() {
hostAddress := nebula.HostAddress{Host: address, Port: port}
hostList := []nebula.HostAddress{hostAddress}
// Create configs for connection pool using default values
testPoolConfig := nebula.GetDefaultConf()
// Initialize connection pool
pool, err := nebula.NewConnectionPool(hostList, testPoolConfig, log)
if err != nil {
log.Fatal(fmt.Sprintf("Fail to initialize the connection pool, host: %s, port: %d, %s", address, port, err.Error()))
}
// Close all connections in the pool
defer pool.Close()
// Create session
session, err := pool.GetSession(username, password)
if err != nil {
log.Fatal(fmt.Sprintf("Fail to create a new session from connection pool, username: %s, password: %s, %s",
username, password, err.Error()))
}
// Release session and return connection back to connection pool
defer session.Release()
{
// Prepare the query
sql := `use manager;MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})<-[e:follow*]-(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass ORDER BY id asc
UNION
MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})-[e:follow*]->(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass ORDER BY id asc
UNION
MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})-[e:follow*0]->(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass;`
// Execute a query
resultSet, err := session.Execute(sql)
if err != nil {
fmt.Print(err.Error())
return
}
fmt.Println(resultSet)
for _, v := range resultSet.GetRows() {
fmt.Println(string(v.GetValues()[0].SVal))
fmt.Println(string(v.GetValues()[1].SVal))
fmt.Println(string(v.GetValues()[2].SVal))
fmt.Println(string(v.GetValues()[3].SVal))
fmt.Println(string(v.GetValues()[4].SVal))
}
}
fmt.Print("\n")
log.Info("Nebula Go Client Basic Example Finished")
} output: &{0xc0000e60e0 [id name batchno process pass] map[batchno:2 id:0 name:1 pass:4 process:3] {0 [85 84 67]}}
|
python code: 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([('124.222.227.15', 9669)], config)
# option 1 control the connection release yourself
# get session from the pool
session = connection_pool.get_session('root', 'nebula')
# select space
session.execute('USE manager')
# show tags
result = session.execute('''
MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})<-[e:follow*]-(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass ORDER BY id asc
UNION
MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})-[e:follow*]->(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass ORDER BY id asc
UNION
MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})-[e:follow*0]->(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass;
''')
print(result)
# release session
session.release()
# close the pool
connection_pool.close() output: ResultSet(keys: ['id', 'name', 'batchno', 'process', 'pass'], values: [52, "成品批号", "BF14CDZ1-210107A1-02", "粉碎", "1"]) |
just run the code upper, the server in the code is available. |
in addition, when i downgrade nebula server to 3.2.0, the go client can query the right results. |
Allow me to ping @Aiee for taking a look at it. |
问题已经解决。之前我写的sql是这样: use manager;MATCH (v:node{batchno: "BF14CDZ1-210107A1-02"})<-[e:follow*]-(v2) RETURN
distinct v2.node.id as id, v2.node.name as name,
v2.node.batchno as batchno, v2.node.process as process,
v2.node.pass as pass ORDER BY id asc; 注意上面是两个sql语句连在一起的,先是 现在我升级到了服务器3.4.0,上面的写法就不行了。两句sql必须分开执行。不知这样的表现行为是有意这么设计,还是前后不兼容的bug? |
ping @Aiee |
我使用的也是3.2.0版本,但是呢如果use和查询语句放在一起也是无法查询出来数据的 :-( |
hi, @supermario1990 我记得之前有一个 bug 是用户 use space 和 rebuild index 的操作一起,触发了某个 bug,还有 use space 之后不能识别后面的语句(参考这个帖子:https://discuss.nebula-graph.com.cn/t/topic/12707/10?u=steam )所以应该是在某个版本开始,use space 要和具体的 query 语句分开了(抱歉我已经不大记得具体的版本号了) cc @wey-gu @pythonsan Hi, @ supermario1990 I remember previously there was a bug where users use |
I updated nebula server from 3.2.0 to 3.4.1, when I use nebula-go client(3.4.0), I can not query anything. while when I use python client(3.4.0), I can query the right results
The text was updated successfully, but these errors were encountered: