我试图使用peewee操作一个表,该表包含一个包含uuid数组的列。在
模型如下:
class test_db(BaseModel):
arr = playhouse.postgres_ext.ArrayField(
peewee.UUIDField,
index_type=False
)
我想在此表中插入一个条目,我使用以下代码:
^{pr2}$但我收到了
^{3}$我也试过这个
arr = ['d167169e-a017-4c17-8f3a-1dee98c1e563']
x = test_db(arr=arr)
x.save()
但我收到了以下错误:
peewee.ProgrammingError: column "arr" is of type uuid[] but expression is of type text[]
LINE 1: INSERT INTO "test_db" ("arr") VALUES (ARRAY['d167169e-a017-4...
^
HINT: You will need to rewrite or cast the expression.
你能为这个问题提供一些帮助吗?在
非常感谢!在
这要求您注册UUID类型:
使用上述代码,您应该能够简单地使用:
^{pr2}$相关问题 更多 >
编程相关推荐