8000 Merge branch 'master' of https://github.com/datajoint/datajoint-python · datajoint/datajoint-python@ed21f34 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed21f34

Browse files
committed
2 parents f3d0ed8 + b2a7eab commit ed21f34

File tree

7 files changed

+60
-34
lines changed

7 files changed

+60
-34
lines changed

.github/workflows/development.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Build pip artifacts
4343
run: |
4444
export HOST_UID=$(id -u)
45-
docker-compose -f docker-compose-build.yaml up --exit-code-from app --build
45+
docker compose -f docker-compose-build.yaml up --exit-code-from app --build
4646
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
4747
- if: matrix.py_ver == '3.9' && matrix.distro == 'debian'
4848
name: Add pip artifacts
@@ -89,7 +89,7 @@ jobs:
8989
COMPOSE_HTTP_TIMEOUT: "120"
9090
run: |
9191
export HOST_UID=$(id -u)
92-
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
92+
docker compose -f LNX-docker-compose.yml up --build --exit-code-from app
9393
lint:
9494
runs-on: ubuntu-latest
9595
strategy:
@@ -220,7 +220,7 @@ jobs:
220220
- name: Publish pip release
221221
run: |
222222
export HOST_UID=$(id -u)
223-
docker-compose -f docker-compose-build.yaml run \
223+
docker compose -f docker-compose-build.yaml run \
224224
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
225225
sh -c "pip install twine && python -m twine upload dist/*"
226226
- name: Login to DockerHub

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
- Added - Missing tests for set_password - PR [#1106](https://github.com/datajoint/datajoint-python/pull/1106)
1212
- Changed - Returning success count after the .populate() call - PR [#1050](https://github.com/datajoint/datajoint-python/pull/1050)
1313
- Fixed - `Autopopulate.populate` excludes `reserved` jobs in addition to `ignore` and `error` jobs
14+
- Fixed - Issue [#1159]((https://github.com/datajoint/datajoint-python/pull/1159) (cascading delete) - PR [#1160](https://github.com/datajoint/datajoint-python/pull/1160)
15+
- Fixed - `docker compose` commands in CI [#1164](https://github.com/datajoint/datajoint-python/pull/1164)
1416

1517
### 0.14.1 -- Jun 02, 2023
1618
- Fixed - Fix altering a part table that uses the "master" keyword - PR [#991](https://github.com/datajoint/datajoint-python/pull/991)

datajoint/table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ def cascade(table):
563563
and match["fk_attrs"] == match["pk_attrs"]
564564
):
565565
child._restriction = table._restriction
566+
child._restriction_attributes = table.restriction_attributes
566567
elif match["fk_attrs"] != match["pk_attrs"]:
567568
child &= table.proj(
568569
**dict(zip(match["fk_attrs"], match["pk_attrs"]))

tests/conftest.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ def schema_any(connection_test, prefix):
285285
schema_any(schema.ThingA)
286286
schema_any(schema.ThingB)
287287
schema_any(schema.ThingC)
288+
schema_any(schema.ThingD)
289+
schema_any(schema.ThingE)
288290
schema_any(schema.Parent)
289291
schema_any(schema.Child)
290292
schema_any(schema.ComplexParent)
@@ -303,6 +305,26 @@ def schema_any(connection_test, prefix):
303305
schema_any.drop()
304306

305307

308+
@pytest.fixture
309+
def thing_tables(schema_any):
310+
a = schema.ThingA()
311+
b = schema.ThingB()
312+
c = schema.ThingC()
313+
d = schema.ThingD()
314+
e = schema.ThingE()
315+
316+
# clear previous contents if any.
317+
c.delete_quick()
318+
b.delete_quick()
319+
a.delete_quick()
320+
321+
a.insert(dict(a=a) for a in range(7))
322+
b.insert1(dict(b1=1, b2=1, b3=100))
323+
b.insert1(dict(b1=1, b2=2, b3=100))
324+
325+
yield a, b, c, d, e
326+
327+
306328
@pytest.fixture
307329
def schema_simp(connection_test, prefix):
308330
schema = dj.Schema(

tests/schema.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,21 @@ class ThingC(dj.Manual):
345345
"""
346346

347347

348+
# Additional tables for #1159
349+
class ThingD(dj.Manual):
350+
definition = """
351+
d: int
352+
---
353+
-> ThingC
354+
"""
355+
356+
357+
class ThingE(dj.Manual):
358+
definition = """
359+
-> ThingD
360+
"""
361+
362+
348363
class Parent(dj.Lookup):
349364
definition = """
350365
parent_id: int

tests/test_cascading_delete.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,16 @@ def test_drop_part(schema_simp_pop):
135135
"""test issue #374"""
136136
with pytest.raises(dj.DataJointError):
137137
Website().drop()
138+
139+
140+
def test_delete_1159(thing_tables):
141+
tbl_a, tbl_c, tbl_c, tbl_d, tbl_e = thing_tables
142+
143+
tbl_c.insert([dict(a=i) for i in range(6)])
144+
tbl_d.insert([dict(a=i, d=i) for i in range(5)])
145+
tbl_e.insert([dict(d=i) for i in range(4)])
146+
147+
(tbl_a & "a=3").delete()
148+
149+
assert len(tbl_a) == 6, "Failed to cascade restriction attributes"
150+
assert len(tbl_e) == 3, "Failed to cascade restriction attributes"

tests/test_dependencies.py

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import datajoint as dj
21
from datajoint import errors
32
from pytest import raises
43
from datajoint.dependencies import unite_master_parts
5-
from .schema import *
64

75

86
def test_unite_master_parts():
@@ -50,22 +48,10 @@ def test_unite_master_parts():
5048
]
5149

5250

53-
def test_nullable_dependency(schema_any):
51+
def test_nullable_dependency(thing_tables):
5452
"""test nullable unique foreign key"""
5553
# Thing C has a nullable dependency on B whose primary key is composite
56-
a = ThingA()
57-
b = ThingB()
58-
c = ThingC()
59-
60-
# clear previous contents if any.
61-
c.delete_quick()
62-
b.delete_quick()
63-
a.delete_quick()
64-
65-
a.insert(dict(a=a) for a in range(7))
66-
67-
b.insert1(dict(b1=1, b2=1, b3=100))
68-
b.insert1(dict(b1=1, b2=2, b3=100))
54+
_, _, c, _, _ = thing_tables
6955

7056
# missing foreign key attributes = ok
7157
c.insert1(dict(a=0))
@@ -79,23 +65,10 @@ def test_nullable_dependency(schema_any):
7965
assert len(c) == len(c.fetch()) == 5
8066

8167

82-
def test_unique_dependency(schema_any):
68+
def test_unique_dependency(thing_tables):
8369
"""test nullable unique foreign key"""
84-
8570
# Thing C has a nullable dependency on B whose primary key is composite
86-
a = ThingA()
87-
b = ThingB()
88-
c = ThingC()
89-
90-
# clear previous contents if any.
91-
c.delete_quick()
92-
b.delete_quick()
93-
a.delete_quick()
94-
95-
a.insert(dict(a=a) for a in range(7))
96-
97-
b.insert1(dict(b1=1, b2=1, b3=100))
98-
b.insert1(dict(b1=1, b2=2, b3=100))
71+
_, _, c, _, _ = thing_tables
9972

10073
c.insert1(dict(a=0, b1=1, b2=1))
10174
# duplicate foreign key attributes = not ok

0 commit comments

Comments
 (0)
0