Ejemplo n.º 1
0
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()
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
def mainUnsuper(source):
    print("WeatherLong.csv")
    unsuper(rows(source))
Ejemplo n.º 5
0
def mainDom(source):
    print(source)
    doms(rows(source))
Ejemplo n.º 6
0
def mainsuper(source):
    super(rows(source))
Ejemplo n.º 7
0
 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]]
Ejemplo n.º 8
0
def mainsuper(s):
    print("WeatherLong.csv")
    super(rows(s))
Ejemplo n.º 9
0
def mainDom(source, count):
    print(source)
    doms(rows(source), count)