UUID的Peewe阵列字段

2024-04-25 14:35:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图使用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.

你能为这个问题提供一些帮助吗?在

非常感谢!在


Tags: of模型testdbuuidistype数组

热门问题