sqlalchemy.exc.CompileError: (in table 'language_label', column 'name'): VARCHAR requires a length o

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)

  

原文地址:https://www.cnblogs.com/liangliangzz/p/10300635.html