nebula-python
nebula-python copied to clipboard
datetime类型参数会被截断为date类型
Please check the FAQ documentation before raising an issue
Describe the bug (required) 在使用SessionPool的execute_py方法查询数据时,在传入datetime类型的参数时,会被强转为date类型,导致查询不到符合条件的数据
Your Environments (required) win11 python3.9
- OS:
uname -a - Commit id (e.g.
a3ffc7d8)
How To Reproduce(required)
Steps to reproduce the behavior:
- 构造数据 CREATE TAG IF NOT EXISTS date_test(d datetime); INSERT VERTEX date_test(d) VALUES "test1":(datetime());
- 编写python代码,执行查询语句 params = { 'd': datetime.datetime(2025, 7, 6, 2, 55, 48, 613)} result_set = NebulaHelper('date_demo').execute_py( 'MATCH (v) WHERE v.date_test.d <= $d RETURN v', params) print(result_set.as_primitive()) 输出为:[] 实际有数据:
- debug模式查看,发现
在类型判断时,date类型会优先判断,而datetime类型也属于date类型,因此会把实际的时间截断为日期格式
Expected behavior
Additional context
感谢,要不要来一个 pr 修一下哈?