Skip to content

Commit

Permalink
BUG: add support for no classes opt arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ksindi committed Sep 12, 2016
1 parent 41ffbbc commit f1560bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sqlacodegen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = __version__ = '1.1.6.0'
version = __version__ = '1.1.6.1'
6 changes: 3 additions & 3 deletions sqlacodegen/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class CodeGenerator(object):

def __init__(self, metadata, noindexes=False, noconstraints=False,
nojoined=False, noinflect=False, nobackrefs=False,
flask=False, ignore_cols=None):
flask=False, ignore_cols=None, noclasses=False):
super(CodeGenerator, self).__init__()

if noinflect:
Expand Down Expand Up @@ -600,9 +600,9 @@ def __init__(self, metadata, noindexes=False, noconstraints=False,
continue

# Only form model classes for tables that have a primary key and are not association tables
if not table.primary_key or table.name in association_tables:
if not table.primary_key or table.name in association_tables or noclasses:
model = ModelTable(table)
else:
elif not noclasses:
model = ModelClass(table, links[table.name], inflect_engine, not nojoined)
classes[model.name] = model

Expand Down
6 changes: 5 additions & 1 deletion sqlacodegen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ def main():
outfile = codecs.open(args.outfile, 'w', encoding='utf-8') if args.outfile else sys.stdout
generator = CodeGenerator(metadata, args.noindexes, args.noconstraints,
args.nojoined, args.noinflect, args.nobackrefs,
args.flask, ignore_cols)
args.flask, ignore_cols, args.noclasses)
generator.render(outfile)


if __name__ == '__main__':
main()

0 comments on commit f1560bb

Please sign in to comment.