crown icon indicating copy to clipboard operation
crown copied to clipboard

创建超级表时,如果meta中tags类型为NCharField类型,则会变成创建普通表

Open horennel opened this issue 2 years ago • 1 comments

class Meters(SuperModel):
    gps = NCharField(db_column='gps')

    class Meta:
        database = db
        db_table = 'meters'
        groupid = NCharField(db_column='gid')


if __name__ == '__main__':
    Meters.create_table(safe=True)

此时的sql被错误解析为

CREATE TABLE "orc.meters" ("ts" TIMESTAMP, "gps" NCHAR(255))

当groupid类型改为其他类型后 可正常创建 sql亦正常

CREATE TABLE "orc.meters" ("ts" TIMESTAMP, "gps" NCHAR(255))  TAGS ("gid" BOOL)

horennel avatar Oct 14 '22 01:10 horennel

将crown.py中的

and not isinstance(v, NCharField)

删除即可

horennel avatar Oct 14 '22 14:10 horennel