Skip to content

Commit 988fc01

Browse files
authored
Merge pull request #20 from waynenilsen/schema-none
my schema was none, but it should have been dbo, added a patch
2 parents 935c14d + 533fe7c commit 988fc01

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sqlacodegen/codegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ def __init__(self, source_cls, target_cls, constraint, inflect_engine):
497497
class ManyToManyRelationship(Relationship):
498498
def __init__(self, source_cls, target_cls, assocation_table, inflect_engine):
499499
super(ManyToManyRelationship, self).__init__(source_cls, target_cls)
500-
501-
self.kwargs['secondary'] = repr(assocation_table.schema + '.' + assocation_table.name)
500+
prefix = assocation_table.schema + '.' if assocation_table.schema is not None else ''
501+
self.kwargs['secondary'] = repr(prefix + assocation_table.name)
502502
constraints = [c for c in assocation_table.constraints if isinstance(c, ForeignKeyConstraint)]
503503
constraints.sort(key=_get_constraint_sort_key)
504504
colname = _get_column_names(constraints[1])[0]

0 commit comments

Comments
 (0)