Skip to content

Commit 533fe7c

Browse files
author
Wayne Nilsen
committed
more general solution
1 parent 5625621 commit 533fe7c

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 or 'dbo' + '.' + 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)