Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Renaming foreign key attributes shuffles the properties of the table attributes #516

Description

@ecobost

With these declarations:

@schema
class A(dj.Manual):
     definition="""
     my_int: int
     my_string: varchar(64)
     ---
     """

@schema
class B(dj.Manual):
     definition = """
     -> A.proj(renamed_int='my_int')
     ---
     """

@schema
class C(dj.Manual):
    definition = """
    (renamed_int) -> A(my_int)
    ---
    """

I get this output:

In [2]: import datajoint as dj                                                                           

In [3]: dj.__version__                                                                                   
Out[3]: '0.11.0'

In [4]: from pipeline import stack     # this is where I defined the classes above
Loading local settings from pipeline_config.json
Connecting ecobost@at-database.ad.bcm.edu:3306

In [5]: stack.A.heading                                                                                  
Out[5]: 
# 
my_int               : int                          # 
my_string            : varchar(64)                  # 

In [6]: stack.B.heading                                                                                  
Out[6]: 
# 
my_string            : int                          # 
renamed_int          : varchar(64)                  # 

In [7]: stack.C.heading                                                                                  
Out[7]: 
# 
my_string            : int                          # 
renamed_int          : varchar(64)                  # 

Projecting sends the renamed variable to the end of the queue but the attribute properties are not shuffled accordingly so, for instance, if I have three attributes p1:int, p2:boolean, p3:varchar and rename p2->p2' I will get p1:int, p3:boolean, p2':varchar.

Cheers,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behaviorenhancementIndicates new improvements

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions