create table card_exams
(
id bigserial not null
constraint card_exams_pkey
primary key,
info jsonb[] not null,
card_id uuid not null
constraint card_exams_card_id_fkey
references cards,
user_id uuid not null
constraint card_exams_user_id_fkey
references users,
inserted_at timestamp with time zone not null,
updated_at timestamp with time zone not null
);```and a peewee model like this:```pythonclass CardExams(BaseModel): card = ForeignKeyField(column_name='card_id', field='id', model=Cards) id = BigAutoField() # info = UnknownField(constraints=[SQL("DEFAULT ARRAY[]::jsonb[]")]) # ARRAY info = ArrayField(BinaryJSONField) inserted_at = DateTimeField() updated_at = DateTimeField() user = ForeignKeyField(column_name='user_id', field='id', model=Users) class Meta: table_name = 'card_exams```and when I insert this data:```phthondata = {'card_id': '00440205-a4b3-4590-80b0-3142f24c240b', 'inserted_at': datetime.datetime(2019, 8, 2, 11, 24, 10, 698754, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), 'updated_at': datetime.datetime(2019, 8, 2, 11, 24, 10, 698780, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=480, name=None)), 'info': ['{"answers": [[" 学术论文", " 知识图谱", " 社会引用", " 了解大牛生平"]], "question": "```MQ\\n\\n\\nQ: 本节视频用了哪些方法了解平克的关键信息?(多选)\\n\\n\\nASWT: 了解大牛生平\\n\\nASWT: 学术论文\\n\\nASWT: 知识图谱\\n\\nASWT: 社会引用\\n\\n\\n```", "is_correct": true}'], 'user_id': '27228430-fb14-11e6-82e4-210703b60b69'}```with this code:```pythonCardExams.create(**data)```will raise an error:```peewee.ProgrammingError: column "info" is of type jsonb[] but expression is of type text[] LINE 1: ...) VALUES ('00440205-a4b3-4590-80b0-3142f24c240b', ARRAY['{"a... ^ HINT: You will need to rewrite or cast the expression.```How do I fix it?
Please post the query output. Use insert instead of create to get the SQL for the operation. `query.sql()` where `query` is what you get from `insert`.
http://docs.peewee-orm.com/en/latest/peewee/api.html#Model.insert
--
You received this message because you are subscribed to the Google Groups "peewee-orm" group.
To unsubscribe from this group and stop receiving emails from it, send an email to peewee-orm+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/344debd3-6461-42d8-8776-5401e61d97c4%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/peewee-orm/CAPukbqwt8VFaBPnCvoVNj7AAS26QBuUE4-41_8dorVdrcoHuDg%40mail.gmail.com.