Skip to content

Commit 3b362e6

Browse files
Apply suggestions from code review
Co-authored-by: Raphael Guzman <[email protected]>
1 parent 4bdd13e commit 3b362e6

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
66
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
77
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
8-
* Bugfix - Fix error when unioning multiple tables (#926) PR #964
8+
* Bugfix - Fix error when performing a union on multiple tables (#926) PR #964
99

1010
### 0.13.2 -- May 7, 2021
1111
* Update `setuptools_certificate` dependency to new name `otumat`

datajoint/expression.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,10 @@ def make_sql(self):
625625
if not arg1.heading.secondary_attributes and not arg2.heading.secondary_attributes:
626626
# no secondary attributes: use UNION DISTINCT
627627
fields = arg1.primary_key
628-
if isinstance(arg1, Union):
629-
sql1 = arg1.make_sql()
630-
else:
631-
sql1 = arg1.make_sql(fields)
632-
if isinstance(arg2, Union):
633-
sql2 = arg2.make_sql()
634-
else:
635-
sql2 = arg2.make_sql(fields)
636-
return "({sql1}) UNION ({sql2})".format(sql1=sql1, sql2=sql2)
628+
return "({sql1}) UNION ({sql2})".format(
629+
sql1=arg1.make_sql() if isinstance(arg1, Union) else arg1.make_sql(fields),
630+
sql2=arg2.make_sql() if isinstance(arg2, Union) else arg2.make_sql(fields),
631+
)
637632
# with secondary attributes, use union of left join with antijoin
638633
fields = self.heading.names
639634
sql1 = arg1.join(arg2, left=True).make_sql(fields)

docs-parts/intro/Releases_lang1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
55
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
66
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
7-
* Bugfix - Fix error when unioning multiple tables (#926) PR #964
7+
* Bugfix - Fix error when performing a union on multiple tables (#926) PR #964
88

99
0.13.2 -- May 7, 2021
1010
----------------------

tests/test_relational_operand.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from os import stat
21
import random
32
import string
43
import pandas
@@ -512,6 +511,4 @@ def test_union_multiple():
512511
# https://github.com/datajoint/datajoint-python/issues/926
513512
q1 = IJ & dict(j=2)
514513
q2 = (IJ & dict(j=2, i=0)) + (IJ & dict(j=2, i=1)) + (IJ & dict(j=2, i=2))
515-
x = set(zip(*q1.fetch('i', 'j')))
516-
y = set(zip(*q2.fetch('i', 'j')))
517-
assert_set_equal(x, y)
514+
assert q1.fetch() == q2.fetch()

0 commit comments

Comments
 (0)