def dependencies(self): """ Gets the tables and views that are related to this column. :return: A dictionary containing a list of related entity names and views respectively. :rtype: dict """ # Get all relations to this column child_relations = self.entity.column_children_relations(self.name) parent_relations = self.entity.column_parent_relations(self.name) r = child_relations + parent_relations # Get children entities parent_entities = [er.parent for er in child_relations if er.parent.action != DbItem.DROP] child_entities = [er.child for er in parent_relations if er.child.action != DbItem.DROP] all_entities = parent_entities + child_entities # Dependent entity names dep_ent_names = [e.name for e in all_entities] # Add views related to this column dep_views = table_view_dependencies(self.entity.name, self.name) return {'entities': dep_ent_names, 'views': dep_views}
def dependencies(self): """ Gets the tables and views that are related to this column. :return: A dictionary containing a list of related entity names and views respectively. :rtype: dict """ #Get all relations to this column child_relations = self.entity.column_children_relations(self.name) parent_relations = self.entity.column_parent_relations(self.name) r = child_relations + parent_relations #Get children entities parent_entities = [er.parent for er in child_relations if er.parent.action != DbItem.DROP] child_entities = [er.child for er in parent_relations if er.child.action != DbItem.DROP] all_entities = parent_entities + child_entities #Dependent entity names dep_ent_names = [e.name for e in all_entities] # Add views related to this column dep_views = table_view_dependencies(self.entity.name, self.name) return {'entities': dep_ent_names, 'views': dep_views}
def dependencies(self): """ Gets the tables and views that are related to the specified entity. :return: A dictionary containing a list of related entity names and views respectively. :rtype: dict """ parents = self.parents() children = self.children() all_relations = parents + children #Dependent entity names dep_ent = [e.short_name for e in all_relations] #Add views as well dep_views = table_view_dependencies(self.name) return {'entities': dep_ent, 'views': dep_views}