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

Feature Request: Overwrite comment when foreign keys used with proj()

Open DonnieKim411 opened this issue 5 years ago • 1 comments

Consider the following table definition:

@schema
class ProjectorColor(dj.Lookup):
    definition = """
    # color options for projector channels
    color_id            : tinyint                   # color id
    ---
    color               : varchar(32)               # color name
    """


@schema
class ProjectorConfig(dj.Lookup):
    definition = """
    # projector configuration
    projector_config    : tinyint                       # projector config    
    ---
    -> ProjectorColor.proj(channel_1="color_id")        # channel 1 means 1st color channel. Usually red
    -> ProjectorColor.proj(channel_2="color_id")        # channel 2 means 2nd color channel. Usually green
    -> ProjectorColor.proj(channel_3="color_id")        # channel 3 means 3rd color channel. Usually blue
    refresh_rate        : float                         # refresh rate in Hz

    """

In this scenario, because channel_1,2, and 3 were renamed from the primary key color_id from the table ProjectorConfig, when you prompt ProjectorConfig.heading, the following happens:

# projector configuration
projector_config     : tinyint                      # projector config
---
channel_1            : tinyint                      # color id
channel_2            : tinyint                      # color id
channel_3            : tinyint                      # color id
refresh_rate         : float                        # refresh rate in Hz

I think it is more useful to show the comments used in the ProjectorConfig for each color channel, not a generic comment used in ProjectorColor.

DonnieKim411 avatar Oct 30 '19 19:10 DonnieKim411

It would make sense to override the comment for any dependency, even with no proj.

dimitri-yatsenko avatar Nov 03 '19 20:11 dimitri-yatsenko