Skip to content

Commit

Permalink
unified string formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Baji committed Feb 9, 2022
1 parent 8718b2b commit 8a6edf6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions datajoint/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,10 +634,11 @@ def make_sql(self):
if not arg1.heading.secondary_attributes and not arg2.heading.secondary_attributes:
# no secondary attributes: use UNION DISTINCT
fields = arg1.primary_key
return ("SELECT * FROM (({sql1}) UNION ({sql2})) as `_u%x`".format(
return ("SELECT * FROM (({sql1}) UNION ({sql2})) as `_u{alias}`".format(
sql1=arg1.make_sql() if isinstance(arg1, Union) else arg1.make_sql(fields),
sql2=arg2.make_sql() if isinstance(arg2, Union) else arg2.make_sql(fields),
)) % next(self.__count)
alias=next(self.__count)
))
# with secondary attributes, use union of left join with antijoin
fields = self.heading.names
sql1 = arg1.join(arg2, left=True).make_sql(fields)
Expand Down

0 comments on commit 8a6edf6

Please sign in to comment.