More pep8 compliant declarative output.
https://code.google.com/p/sqlalchemy-migrate/issues/detail?id=122
This commit is contained in:
parent
bf2fcaf2ee
commit
75df12b227
@ -101,15 +101,17 @@ class ModelGenerator(object):
|
|||||||
tableName = table.name
|
tableName = table.name
|
||||||
if self.declarative:
|
if self.declarative:
|
||||||
out.append("class %(table)s(Base):" % {'table': tableName})
|
out.append("class %(table)s(Base):" % {'table': tableName})
|
||||||
out.append(" __tablename__ = '%(table)s'" % {'table': tableName})
|
out.append(" __tablename__ = '%(table)s'\n" %
|
||||||
|
{'table': tableName})
|
||||||
for col in table.columns:
|
for col in table.columns:
|
||||||
out.append(" %s" % self.column_repr(col))
|
out.append(" %s" % self.column_repr(col))
|
||||||
|
out.append('\n')
|
||||||
else:
|
else:
|
||||||
out.append("%(table)s = Table('%(table)s', meta," % \
|
out.append("%(table)s = Table('%(table)s', meta," %
|
||||||
{'table': tableName})
|
{'table': tableName})
|
||||||
for col in table.columns:
|
for col in table.columns:
|
||||||
out.append(" %s," % self.column_repr(col))
|
out.append(" %s," % self.column_repr(col))
|
||||||
out.append(")")
|
out.append(")\n")
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def _get_tables(self,missingA=False,missingB=False,modified=False):
|
def _get_tables(self,missingA=False,missingB=False,modified=False):
|
||||||
@ -133,7 +135,6 @@ class ModelGenerator(object):
|
|||||||
out.append("")
|
out.append("")
|
||||||
for table in self._get_tables(missingA=True):
|
for table in self._get_tables(missingA=True):
|
||||||
out.extend(self.getTableDefn(table))
|
out.extend(self.getTableDefn(table))
|
||||||
out.append("")
|
|
||||||
return '\n'.join(out)
|
return '\n'.join(out)
|
||||||
|
|
||||||
def toUpgradeDowngradePython(self, indent=' '):
|
def toUpgradeDowngradePython(self, indent=' '):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user