nebula-python客户端查询tag的默认值出错

  • nebula 版本:3.1
  • nebula-python 版本: 3.1
  • 部署方式:分布式
  • 安装方式:源码编译
  • 是否为线上版本:Y

使用nebula-python客户端查询tag字段的默认值出错。

默认值真实值

image

查询出的实际值

decode(‘utf-8’)后的值:

image

调用代码贴一下

schema = meta_cache.get_tag_schema('test_space', 'player_with_default')
print(schema)
for col in schema.columns:
    print(col.default_value.decode('utf-8'))

这是一个 bug 哈,研发在修复啦,参见 issue `get_tag_schema()` returns non-decoded result · Issue #242 · vesoft-inc/nebula-python · GitHub

这个是设计上的问题,服务端 meta 存的默认值,是不能直接解码的。

如果实在需要,可以通过 graph 客户端的 desc tag xxx

(root@nebula) [sf0_1]> desc tag player
+--------+------------+-------+--------------+---------+
| Field  | Type       | Null  | Default      | Comment |
+--------+------------+-------+--------------+---------+
| "name" | "string"   | "YES" | "aaa"        |         |
| "age"  | "int64"    | "YES" | 21           |         |
| "dt"   | "datetime" | "YES" | "datetime()" |         |
| "t"    | "datetime" | "YES" | "datetime()" |         |
+--------+------------+-------+--------------+---------+
Got 4 rows (time spent 469/16595 us)
3 个赞