Commit 26bda4c
committed
fix(deploy): address MilagrosMarin review on #1466
- Replace `assert` statements with explicit `if … raise DataJointError(…)`
in the dispatch ladder. Project convention is to avoid assertions for
runtime guarantees because Python's -O strips them; deploy-hook
environments may run under -O and would otherwise see AttributeError
on None instead of the intended DataJointError. The unactivated-schema
case (database is None) is the most concerning since it would have
emitted a malformed ALTER TABLE.
- Add four unit tests covering previously-untested branches:
- `test_set_replica_identity_table_instance_target` — Table-instance
dispatch (deploy.py: isinstance(target, Table) branch).
- `test_set_replica_identity_table_class_target` — Table-class
dispatch (deploy.py: issubclass(target, Table) branch).
- `test_set_replica_identity_case_insensitive_mode` — mode="FULL"
accepted, matching adapter's case-tolerant handling.
- `test_set_replica_identity_unactivated_schema_raises` — Schema with
database=None raises rather than emitting malformed DDL.
- Accept uppercase mode strings (`mode.lower()` normalization) for
parity with the PG adapter's case-tolerant DDL emission.
- Tighten type hints: `target: TargetType` (Union of Schema/Table-class/
Table-instance via TYPE_CHECKING forward references), `mode: Literal[
"default", "full"]`. Runtime validation unchanged.
- Docstring additions:
- Cost section now flags the brief AccessExclusiveLock the ALTER takes.
- New "Partial-failure semantics" paragraph explaining that exceptions
on table N of M leave first N-1 tables modified but propagate without
returning the partial summary; idempotency makes re-running safe.
- Style: split the adjacent-string concatenation on the "PostgreSQL-only"
error into a single literal.
All 20 unit tests pass (was 16 + 4 new).1 parent 13fd087 commit 26bda4c
2 files changed
Lines changed: 105 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
27 | 32 | | |
28 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
61 | 83 | | |
62 | 84 | | |
63 | 85 | | |
| |||
112 | 134 | | |
113 | 135 | | |
114 | 136 | | |
115 | | - | |
| 137 | + | |
| 138 | + | |
116 | 139 | | |
| 140 | + | |
117 | 141 | | |
118 | 142 | | |
119 | 143 | | |
120 | 144 | | |
121 | 145 | | |
122 | 146 | | |
123 | | - | |
| 147 | + | |
| 148 | + | |
124 | 149 | | |
125 | | - | |
| 150 | + | |
| 151 | + | |
126 | 152 | | |
127 | 153 | | |
128 | 154 | | |
129 | 155 | | |
130 | | - | |
| 156 | + | |
| 157 | + | |
131 | 158 | | |
132 | 159 | | |
133 | 160 | | |
134 | 161 | | |
135 | | - | |
| 162 | + | |
| 163 | + | |
136 | 164 | | |
137 | 165 | | |
138 | 166 | | |
139 | 167 | | |
140 | 168 | | |
141 | 169 | | |
142 | 170 | | |
143 | | - | |
| 171 | + | |
144 | 172 | | |
145 | 173 | | |
146 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
0 commit comments