Skip to content

Commit f8108a3

Browse files
committed
Fix merge conflicts.
2 parents 13b77d4 + a1d27f3 commit f8108a3

File tree

7 files changed

+43
-6
lines changed

7 files changed

+43
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
## Release notes
22

33
### 0.13.3 -- TBD
4+
* Add - Expose proxy feature for S3 external stores (#961) PR #962
45
* Bugfix - Dependencies not properly loaded on populate. (#902) PR #919
56
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
67
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
78
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
89
* Bugfix - Fix regression issue with DISTINCT clause and GROUP_BY (#914) PR #963
10+
* Bugfix - Fix assertion error when performing a union into a join (#930) PR #967
911

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

datajoint/expression.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,11 @@ def join(self, other, semantic_check=True, left=False):
268268
- join_attributes)
269269
# need subquery if any of the join attributes are derived
270270
need_subquery1 = (need_subquery1 or isinstance(self, Aggregation) or
271-
any(n in self.heading.new_attributes for n in join_attributes))
271+
any(n in self.heading.new_attributes for n in join_attributes)
272+
or isinstance(self, Union))
272273
need_subquery2 = (need_subquery2 or isinstance(other, Aggregation) or
273-
any(n in other.heading.new_attributes for n in join_attributes))
274+
any(n in other.heading.new_attributes for n in join_attributes)
275+
or isinstance(self, Union))
274276
if need_subquery1:
275277
self = self.make_subquery()
276278
if need_subquery2:

datajoint/s3.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
from io import BytesIO
55
import minio # https://docs.minio.io/docs/python-client-api-reference
6+
import urllib3
67
import warnings
78
import uuid
89
import logging
@@ -16,9 +17,24 @@ class Folder:
1617
"""
1718
A Folder instance manipulates a flat folder of objects within an S3-compatible object store
1819
"""
19-
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False, **_):
20-
self.client = minio.Minio(endpoint, access_key=access_key, secret_key=secret_key,
21-
secure=secure)
20+
def __init__(self, endpoint, bucket, access_key, secret_key, *, secure=False,
21+
proxy_server=None, **_):
22+
# from https://docs.min.io/docs/python-client-api-reference
23+
self.client = minio.Minio(
24+
endpoint,
25+
access_key=access_key,
26+
secret_key=secret_key,
27+
secure=secure,
28+
http_client=(
29+
urllib3.ProxyManager(proxy_server,
30+
timeout=urllib3.Timeout.DEFAULT_TIMEOUT,
31+
cert_reqs="CERT_REQUIRED",
32+
retries=urllib3.Retry(total=5,
33+
backoff_factor=0.2,
34+
status_forcelist=[500, 502, 503,
35+
504]))
36+
if proxy_server else None),
37+
)
2238
self.bucket = bucket
2339
if not self.client.bucket_exists(bucket):
2440
raise errors.BucketInaccessible('Inaccessible s3 bucket %s' % bucket)

datajoint/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ def get_store_spec(self, store):
137137
spec['subfolding'] = spec.get('subfolding', DEFAULT_SUBFOLDING)
138138
spec_keys = { # REQUIRED in uppercase and allowed in lowercase
139139
'file': ('PROTOCOL', 'LOCATION', 'subfolding', 'stage'),
140-
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION', 'secure', 'subfolding', 'stage')}
140+
's3': ('PROTOCOL', 'ENDPOINT', 'BUCKET', 'ACCESS_KEY', 'SECRET_KEY', 'LOCATION',
141+
'secure', 'subfolding', 'stage', 'proxy_server')}
141142

142143
try:
143144
spec_keys = spec_keys[spec.get('protocol', '').lower()]

docs-parts/intro/Releases_lang1.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
0.13.3 -- TBD
22
----------------------
3+
* Add - Expose proxy feature for S3 external stores (#961) PR #962
34
* Bugfix - Dependencies not properly loaded on populate. (#902) PR #919
45
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
56
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
67
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
78
* Bugfix - Fix regression issue with DISTINCT clause and GROUP_BY (#914) PR #963
9+
* Bugfix - Fix assertion error when performing a union into a join (#930) PR #967
810

911
0.13.2 -- May 7, 2021
1012
----------------------

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ minio>=7.0.0
1010
matplotlib
1111
cryptography
1212
otumat
13+
urllib3

tests/test_aggr_regressions.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,16 @@ def test_issue558_part2():
103103
d = dict(id=3, id2=5)
104104
assert_equal(len(X & d), len((X & d).proj(id2='3')))
105105

106+
107+
def test_union_join():
108+
# https://github.com/datajoint/datajoint-python/issues/930
109+
A.insert(zip([100, 200, 300, 400, 500, 600]))
110+
B.insert([(100, 11), (200, 22), (300, 33), (400, 44)])
111+
q1 = B & 'id < 300'
112+
q2 = B & 'id > 300'
113+
114+
expected_data = [{'id': 0, 'id2': 5}, {'id': 1, 'id2': 6}, {'id': 2, 'id2': 7},
115+
{'id': 3, 'id2': 8}, {'id': 4, 'id2': 9}, {'id': 100, 'id2': 11},
116+
{'id': 200, 'id2': 22}, {'id': 400, 'id2': 44}]
117+
118+
assert ((q1 + q2) * A).fetch(as_dict=True) == expected_data

0 commit comments

Comments
 (0)