Skip to content

Commit aa82a88

Browse files
fix: Pass make_kwargs to make_fetch in tripartite pattern
When using generator-based make (make_fetch, make_compute, make_insert), make_kwargs passed to populate() were not being forwarded to make_fetch. This caused TypeError when using make_kwargs with the tripartite pattern. Fixes #1350 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 512af13 commit aa82a88

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/datajoint/autopopulate.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def _rename_attributes(table, props):
204204
self._key_source *= _rename_attributes(*q)
205205
return self._key_source
206206

207-
def make(self, key: dict[str, Any]) -> None | Generator[Any, Any, None]:
207+
def make(self, key: dict[str, Any], **kwargs) -> None | Generator[Any, Any, None]:
208208
"""
209209
Compute and insert data for one key.
210210
@@ -219,6 +219,9 @@ def make(self, key: dict[str, Any]) -> None | Generator[Any, Any, None]:
219219
----------
220220
key : dict
221221
Primary key value identifying the entity to compute.
222+
**kwargs
223+
Keyword arguments passed from ``populate(make_kwargs=...)``.
224+
These are forwarded to ``make_fetch`` for the tripartite pattern.
222225
223226
Raises
224227
------
@@ -232,7 +235,7 @@ def make(self, key: dict[str, Any]) -> None | Generator[Any, Any, None]:
232235
233236
**Tripartite make**: For long-running computations, implement:
234237
235-
- ``make_fetch(key)``: Fetch data from parent tables
238+
- ``make_fetch(key, **kwargs)``: Fetch data from parent tables
236239
- ``make_compute(key, *fetched_data)``: Compute results
237240
- ``make_insert(key, *computed_result)``: Insert results
238241
@@ -250,7 +253,7 @@ def make(self, key: dict[str, Any]) -> None | Generator[Any, Any, None]:
250253
# User has implemented `_fetch`, `_compute`, and `_insert` methods instead
251254

252255
# Step 1: Fetch data from parent tables
253-
fetched_data = self.make_fetch(key) # fetched_data is a tuple
256+
fetched_data = self.make_fetch(key, **kwargs) # fetched_data is a tuple
254257
computed_result = yield fetched_data # passed as input into make_compute
255258

256259
# Step 2: If computed result is not passed in, compute the result

0 commit comments

Comments
 (0)