@@ -100,9 +100,11 @@ def primary_key(self):
100
100
101
101
def from_clause (self ):
102
102
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
+ )
106
108
for src in self .support
107
109
)
108
110
clause = next (support )
@@ -704,14 +706,16 @@ def make_sql(self, fields=None):
704
706
fields = fields ,
705
707
from_ = self .from_clause (),
706
708
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
+ )
715
719
)
716
720
),
717
721
)
@@ -773,12 +777,16 @@ def make_sql(self):
773
777
# no secondary attributes: use UNION DISTINCT
774
778
fields = arg1 .primary_key
775
779
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
+ ),
782
790
alias = next (self .__count ),
783
791
)
784
792
# with secondary attributes, use union of left join with antijoin
0 commit comments