Skip to content

Commit c7020f7

Browse files
committed
simplify flatten calls
1 parent 37351db commit c7020f7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

datajoint/expression.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,11 @@ def where_clause(self):
124124
def sorting_clauses(self):
125125
if not self._top:
126126
return ""
127-
clause = (
128-
""
129-
if not any(_flatten_attribute_list(self.primary_key, self._top.order_by))
130-
else f" ORDER BY \
131-
{', '.join(_flatten_attribute_list(self.primary_key, self._top.order_by))}"
127+
clause = ", ".join(
128+
_flatten_attribute_list(self.primary_key, self._top.order_by)
132129
)
130+
if clause:
131+
clause = f" ORDER BY {clause}"
133132
if self._top.limit is not None:
134133
clause += f" LIMIT {self._top.limit} \
135134
{f' OFFSET {self._top.offset}' if self._top.offset else ''}"

0 commit comments

Comments
 (0)