Peewee ArrayField错误

时间:2017-12-25 15:45:03

标签: python peewee

当我基于没有ArrayField的模型创建表时,我没有错误。

当我添加:

images = ArrayField(CharField)

我明白了:

  Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 5037, in create_table
    db.create_table(cls)
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3914, in create_table
    return self.execute_sql(*qc.create_table(model_class, safe))
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3837, in execute_sql
    self.commit()
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3656, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 135, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/site-packages/peewee.py", line 3830, in execute_sql
    cursor.execute(sql, params or ())
peewee.OperationalError: near "[]": syntax error

任何人都可以指出原因并提供解决方案吗?

1 个答案:

答案 0 :(得分:0)

您使用的是哪种数据库驱动程序? ArrayField需要postgresql。