def index(data, keys=None): # return dict that uses keys to index data o = Index(keys) if isinstance(data, Cube): if data.edges[0].name==keys[0]: #QUICK PATH names = list(data.data.keys()) for d in (set_default(mo_dots.zip(names, r), {keys[0]: p}) for r, p in zip(zip(*data.data.values()), data.edges[0].domain.partitions.value)): o.add(d) return o else: Log.error("Can not handle indexing cubes at this time") for d in data: o.add(d) return o
def __init__(self, table_name, columns): self.table = table_name # USED AS AN EXPLICIT STATEMENT OF PERSPECTIVE IN THE DATABASE self.lookup = Index(keys=[join_field(["names", self.table])], data=columns)