类似其他数据库构造带参数的查询语句,sql = “select id from users where username=@username and password=@password”;
可以的,比如
nebula> GO FROM 100 OVER follow REVERSELY YIELD follow._dst AS id | \
GO FROM $-.id OVER serve WHERE $^.player.age > 20 YIELD $^.player.name AS FriendOf, $$.team.name AS Team;
============================
| FriendOf | Team |
============================
| Tony Parker | Warriors |
----------------------------
| Kyle Anderson | Warriors |
----------------------------
1 个赞
这种只适用于管道子查询吧,参数绑定方式执行sql,类似这样:
sql = “select id from users where username=@un and password=@pw”;
execute(sql, un=‘root’,pw=‘root’)
这个有点像lookup了。比如:
nebula> LOOKUP ON player WHERE player.name == "Tony Parker" \
YIELD player.name, player.age;
=======================================
| VertexID | player.name | player.age |
=======================================
| 101 | Tony Parker | 36 |
---------------------------------------
1.0不支持参数, 2.0将来会支持使用$param的形式调用外部参数
1 个赞
请问现在2.0版本可以支持调用外部参数的查询吗?