labpack/databases/sql.py
def _compare_columns(self, new_columns, old_columns):
        
        ''' a helper method for generating differences between column properties '''
        
        # print(new_columns)
        # print(old_columns)
        
        add_columns = {}
        remove_columns = {}
        rename_columns = {}
        retype_columns = {}
        resize_columns = {}
        for key, value in new_columns.items():
            if key not in old_columns.keys():
                add_columns[key] = True
                if value[2]:
                    if value[2] in old_columns.keys():
                        rename_columns[key] = value[2]
                        del add_columns[key]
            else:
                if value[1] != old_columns[key][1]:
                    retype_columns[key] = value[1]
                if value[3] != old_columns[key][3]:
                    resize_columns[key] = value[3]
        remove_keys = set(old_columns.keys()) - set(new_columns.keys())
        if remove_keys:
            for key in list(remove_keys):
                remove_columns[key] = True
        
        return add_columns, remove_columns, rename_columns, retype_columns, resize_columns
 a helper method for generating differences between column properties 
a helper method for generating differences between column properties
a helper method for generating differences between column properties
def _compare_columns(self, new_columns, old_columns):
        add_columns = {}
        remove_columns = {}
        rename_columns = {}
        retype_columns = {}
        resize_columns = {}
        for key, value in new_columns.items():
            if key not in old_columns.keys():
                add_columns[key] = True
                if value[2]:
                    if value[2] in old_columns.keys():
                        rename_columns[key] = value[2]
                        del add_columns[key]
            else:
                if value[1] != old_columns[key][1]:
                    retype_columns[key] = value[1]
                if value[3] != old_columns[key][3]:
                    resize_columns[key] = value[3]
        remove_keys = set(old_columns.keys()) - set(new_columns.keys())
        if remove_keys:
            for key in list(remove_keys):
                remove_columns[key] = True
        return add_columns, remove_columns, rename_columns, retype_columns, resize_columns
def _compare_columns ( self , new_columns , old_columns ) : add_columns = { } remove_columns = { } rename_columns = { } retype_columns = { } resize_columns = { } for key , value in new_columns . items ( ) : if key not in old_columns . keys ( ) : add_columns [ key ] = True if value [ 2 ] : if value [ 2 ] in old_columns . keys ( ) : rename_columns [ key ] = value [ 2 ] del add_columns [ key ] else : if value [ 1 ] != old_columns [ key ] [ 1 ] : retype_columns [ key ] = value [ 1 ] if value [ 3 ] != old_columns [ key ] [ 3 ] : resize_columns [ key ] = value [ 3 ] remove_keys = set ( old_columns . keys ( ) ) - set ( new_columns . keys ( ) ) if remove_keys : for key in list ( remove_keys ) : remove_columns [ key ] = True return add_columns , remove_columns , rename_columns , retype_columns , resize_columns
a helper method for generating differences between column properties
a helper method for generating differences between column properties
''' a helper method for generating differences between column properties ''' # print(new_columns) # print(old_columns)
self
new_columns
old_columns