datajoint-python icon indicating copy to clipboard operation
datajoint-python copied to clipboard

IMPR: Documentation for populate generator

Open CBroz1 opened this issue 5 months ago • 1 comments
trafficstars

Improvement Request

Problem

#1204 added the ability to delay the transaction within a populate call until needed, but did not provide instructions/documentation on proper use of this feature.

Does it require two yields? Before and after the inserts, but what should I yield to preserve referential integrity?

class MyTable(dj.Computed):
    ...
    def make(self, key):
        ret = some_processing(key)
        yield key # ?
        self.insert1(ret)
        yield key # ?

In an initial implementation attempt, I saw a StopIteration error with only one yield.

Requirements

A description of how to implement/benefit from this feature

Related Errors

Please include steps to reproduce provided errors as follows:

  • OS Linux
  • Python Version: 3.9.18
  • MySQL Version: 8.0.34
  • MySQL Deployment Strategy: local-docker
  • DataJoint Version: 0.14.4
  • Minimum number of steps to reliably reproduce the issue: n/a
  • Complete error stack as a result of evaluating the above steps: n/a

Screenshots

n/a

CBroz1 avatar Jun 18 '25 21:06 CBroz1