def select(self, *args, **kw): """Add attribute names to the select list for this query. The attributes in the select list will be returned in the query results, and can be used without further network traffic""" for sel in args: parts = split_attribute(sel) for i in range(1, len(parts)): self.sel_list.append('.'.join(parts[:i])) self.sel_list.append(sel) return self
def select(self, *args, **kw): """Add attribute names to the select list for this query. The attributes in the select list will be returned in the query results, and can be used without further network traffic""" for sel in args: parts = split_attribute(sel) for i in range(1, len(parts)): pname = '.'.join(parts[:i]) if pname not in self.sel_list: self.sel_list.append(pname) self.sel_list.append(sel) return self
def get_related_assets(self, output, relation): if self.is_attribute_qualified(relation): parts = split_attribute(relation) assets = output[parts[0]] for part in parts[1:]: try: asset = assets[0] except IndexError: return [] assets = asset._v1_getattr(part) return assets else: return output[relation]
def split_relation_to_container_and_leaf(self, relation): parts = split_attribute(relation) return ('.'.join(parts[:-1]), parts[-1])
def is_attribute_qualified(self, relation): parts = split_attribute(relation) return len(parts) > 1