Skip to content

Commit aa6f8cc

Browse files
author
Rohit Shende
committed
Fixed the condition to only work for --flask and change db.ENUM to db.Enum
1 parent 706dd89 commit aa6f8cc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sqlacodegen/codegen.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ def _render_column_type(coltype):
126126
else:
127127
args.append(repr(value))
128128

129+
text = _flask_prepend + coltype.__class__.__name__
130+
129131
# In case of ENUM from sqlalchemy.dialects, the flask used db.Enum
130-
if coltype.__class__.__name__ == "ENUM":
131-
text = _flask_prepend + "Enum"
132-
else:
133-
text = _flask_prepend + coltype.__class__.__name__
132+
if text == "db.ENUM":
133+
text = "db.Enum"
134134

135135
if args:
136136
text += '({0})'.format(', '.join(args))

0 commit comments

Comments
 (0)