@@ -100,9 +100,11 @@ def primary_key(self):
100100
101101 def from_clause (self ):
102102 support = (
103- "(" + src .make_sql () + ") as `$%x`" % next (self ._subquery_alias_count )
104- if isinstance (src , QueryExpression )
105- else src
103+ (
104+ "(" + src .make_sql () + ") as `$%x`" % next (self ._subquery_alias_count )
105+ if isinstance (src , QueryExpression )
106+ else src
107+ )
106108 for src in self .support
107109 )
108110 clause = next (support )
@@ -704,14 +706,16 @@ def make_sql(self, fields=None):
704706 fields = fields ,
705707 from_ = self .from_clause (),
706708 where = self .where_clause (),
707- group_by = ""
708- if not self .primary_key
709- else (
710- " GROUP BY `%s`" % "`,`" .join (self ._grouping_attributes )
711- + (
712- ""
713- if not self .restriction
714- else " HAVING (%s)" % ")AND(" .join (self .restriction )
709+ group_by = (
710+ ""
711+ if not self .primary_key
712+ else (
713+ " GROUP BY `%s`" % "`,`" .join (self ._grouping_attributes )
714+ + (
715+ ""
716+ if not self .restriction
717+ else " HAVING (%s)" % ")AND(" .join (self .restriction )
718+ )
715719 )
716720 ),
717721 )
@@ -773,12 +777,16 @@ def make_sql(self):
773777 # no secondary attributes: use UNION DISTINCT
774778 fields = arg1 .primary_key
775779 return "SELECT * FROM (({sql1}) UNION ({sql2})) as `_u{alias}`" .format (
776- sql1 = arg1 .make_sql ()
777- if isinstance (arg1 , Union )
778- else arg1 .make_sql (fields ),
779- sql2 = arg2 .make_sql ()
780- if isinstance (arg2 , Union )
781- else arg2 .make_sql (fields ),
780+ sql1 = (
781+ arg1 .make_sql ()
782+ if isinstance (arg1 , Union )
783+ else arg1 .make_sql (fields )
784+ ),
785+ sql2 = (
786+ arg2 .make_sql ()
787+ if isinstance (arg2 , Union )
788+ else arg2 .make_sql (fields )
789+ ),
782790 alias = next (self .__count ),
783791 )
784792 # with secondary attributes, use union of left join with antijoin
0 commit comments