Esempio n. 1
0
    def insert_chunk(self, name, chunk):
        headers = self.get_headers(name, del_id=True)

        values = list(
            map(lambda x: TableHelper.prepare_values(headers, x), chunk))

        self.conn.execute(self._tables[name].insert(), values)
Esempio n. 2
0
 def test_add_table(self):
     table = TableHelper.make_table("addtable",
                                    self.cache.metadata,
                                    self.headers)
     self.cache.add_table("addtable", table)
     self.assertIsInstance(self.cache._tables['addtable'],
                           Table)
Esempio n. 3
0
 def test_make_table(self):
     urlsql = "sqlite://"
     sql = SQL(urlsql)
     table = TableHelper.make_table("test",
                                    sql.metadata,
                                    self.headers)
     self.assertIsInstance(table, Table)
Esempio n. 4
0
    def insert_row(self, name, values):
        """
        Recibe `name` str es el tipo de tabla.
        Y values que puede ser un vector. :
        """
        headers = self.get_headers(name)
        # tiene que borrar el id
        headers.pop(0)
        keys_values = TableHelper.prepare_values(headers, values)

        #keys_values=self._tables[name].prepare_values(values)
        self.conn.execute(self._tables[name].insert(), **keys_values)
Esempio n. 5
0
 def create_table(self, name, headers):
     table = TableHelper.make_table(name, self.metadata, headers)
     table.create(self.engine, checkfirst=True)
     self.add_table(name, table)
Esempio n. 6
0
 def test_make_columns_coltype(self):
     c = TableHelper.make_columns("test", self.headers)
     self.assertIsInstance(c[0], Column)
Esempio n. 7
0
    def test_make_columns(self):
        c = TableHelper.make_columns("test", self.headers)

        self.assertEqual(len(c), len(self.headers) + 1)