def union(table_a, table_b, all_=False): """Creates a table from two tables that have been combined.""" table = Table.from_iter(table_a) for row in rows(table_b): table.insert(*row) if all_: return table return table.distinct()
def __extend_data(self): """Adds columns to internal table as necessary.""" if ("type", type) not in self.__data.schema: self.__data.alter_add("type", type) for name, data in rows(self.__data("name", "data")): self.__data.where(name=name).update(type=type(data)) self.__data.alter_add("lock", _Lock) self.__data.alter_add("copy", object)
def __select_with_function(self, excess, functions): """Creates virtual rows formed by calling functions on columns.""" table = self.copy() for code, data in functions: if data in table.__columns: data_name = "{}({})".format(code.__name__, data) data_type = type(code(next(rows(table(data)))[0])) table.alter_add(data_name, data_type) dest = table.__columns[data_name][1] sour = table.__columns[data][1] for row in table.__data_area.values(): row[dest] = code(row[sour]) else: sour = code() table.alter_add(data, type(sour)) dest = table.__columns[data][1] for row in table.__data_area.values(): row[dest] = copy.deepcopy(sour) for column in excess: table.alter_drop(column) return table
def mainUnsuper(source): print("WeatherLong.csv") unsuper(rows(source))
def mainDom(source): print(source) doms(rows(source))
def mainsuper(source): super(rows(source))
def __iter__(self): """Iterates over the names of the tables and views in the database.""" for row in rows(self.__data("name")): yield self[row[0]]
def mainsuper(s): print("WeatherLong.csv") super(rows(s))
def mainDom(source, count): print(source) doms(rows(source), count)