Pyorient试图将数据库字段映射到对象属性,但是python文档显示the valid characters for identifiers are the same as in Python 2.x: the uppercase and lowercase letters A through Z, the underscore _ and, except for the first character, the digits 0 through 9.(source)。因此,不能使用“@”作为字段名,而期望pyorient起作用。在
您的问题是python/pyorient(我假设您使用pyorient是基于您的其他问题)。在
Pyorient试图将数据库字段映射到对象属性,但是python文档显示
the valid characters for identifiers are the same as in Python 2.x: the uppercase and lowercase letters A through Z, the underscore _ and, except for the first character, the digits 0 through 9.
(source)。因此,不能使用“@”作为字段名,而期望pyorient起作用。在我去看了一下pyorient的源代码,结果发现问题甚至比上面提到的还要严重。。。 pyorient/types.py
因此,pyorient假定任何以“@”字符开头的记录字段后跟类/集群名称,然后是字段的dict。我想您可以发布到pyorient issue queue并建议上面的elif部分应该检查
content[key]
是dict还是“简单值”。如果它是一个dict,它应该像当前一样处理,否则应该像字段一样处理,但是要从中去掉@。在最终,在字段名中不使用@符号将是最简单的解决方案。
相关问题 更多 >
编程相关推荐