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

Fix error when altering Part table that uses "master" keyword

Open rly opened this issue 2 years ago • 1 comments

Fix #936.

The core of the issue appears to be that the "master" keyword in the Part table definition does not match the name of a table in context. So in this PR, I update alter only for Part tables so that "master" refers to the master table in context. There may be a more elegant way to fix this issue, but this seems to do the trick.

rly avatar Feb 09 '22 11:02 rly

This solution does not handle the case of a part table using the "master" keyword in a more complex way, though.

@schema
class Probe(dj.Manual):
    definition = """
    id: int
    """

    class Shank(dj.Part):
        definition = """
        -> master
        """

    class Electrode(dj.Part):
        definition = """
        -> master.Shank
        """

rly avatar Feb 09 '22 12:02 rly

Thanks for taking a look at this PR. This issue comes up in the Frank Lab often.

Syntax, integration, and style checks pass. Thanks for the comprehensive developer documentation!

rly avatar Feb 23 '23 17:02 rly