sqlalchemy.exc.CompileError: (in table 'language_label', column 'name'): VARCHAR req

Posted 青春叛逆者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sqlalchemy.exc.CompileError: (in table 'language_label', column 'name'): VARCHAR req相关的知识,希望对你有一定的参考价值。

def visit_VARCHAR(self, type_, **kw):
        if type_.length:
            return self._extend_string(
                type_, {}, "VARCHAR(%d)" % type_.length)
        else:
            raise exc.CompileError(
                "VARCHAR requires a length on dialect %s" %
                self.dialect.name)

  to

def visit_VARCHAR(self, type_, **kw):
        if type_.length is None:
            type_.length = 255
        if type_.length:
            return self._extend_string(
                type_, {}, "VARCHAR(%d)" % type_.length)
        else:
            raise exc.CompileError(
                "VARCHAR requires a length on dialect %s" %
                self.dialect.name)

  

以上是关于sqlalchemy.exc.CompileError: (in table 'language_label', column 'name'): VARCHAR req的主要内容,如果未能解决你的问题,请参考以下文章