예제 #1
0
    def test_table_basic(self):
        """Basic operations on datasets"""

        db = Database(self.dsn)
        db.open()

        ds = db.new_dataset(vid=self.dn[0], source='source', dataset='dataset')
        ds.new_table('table1')

        db.commit()

        t1 = db.dataset(ds.vid).table('table1')

        t1.add_column('col1', description='foobar')

        db.commit()
예제 #2
0
    def test_table_basic(self):
        """Basic operations on datasets"""

        db = Database(self.dsn)
        db.open()

        ds = db.new_dataset(vid=self.dn[0], source='source', dataset='dataset')
        ds.new_table('table1')

        db.commit()

        t1 = db.dataset(ds.vid).table('table1')

        t1.add_column('col1', description='foobar')

        db.commit()
예제 #3
0
    def test_a_lot_of_tables(self):
        from contexttimer import Timer

        db = Database(self.dsn)
        db.open()

        ds = db.new_dataset(vid=self.dn[0], source='source', dataset='dataset')

        with Timer() as tr:
            for i in range(100):
                t = ds.new_table('table' + str(i))

                for j in range(10):
                    t.add_column('col' + str(j), datatype='integer')

            ds.commit()

        print(len(ds.tables), len(ds.tables) / tr.elapsed)

        self.assertEqual(100, len(ds.tables))

        for t in ds.tables:
            self.assertEqual(11, len(t.columns))  # 10 + id column
예제 #4
0
    def test_a_lot_of_tables(self):
        from contexttimer import Timer

        db = Database(self.dsn)
        db.open()

        ds = db.new_dataset(vid=self.dn[0], source='source', dataset='dataset')

        with Timer() as tr:
            for i in range(100):
                t = ds.new_table('table' + str(i))

                for j in range(10):
                    t.add_column('col' + str(j), datatype='integer')

            ds.commit()

        print(len(ds.tables), len(ds.tables) / tr.elapsed)

        self.assertEqual(100, len(ds.tables))

        for t in ds.tables:
            self.assertEqual(11, len(t.columns))  # 10 + id column
예제 #5
0
 def test_creates_new_dataset(self):
     db = Database('sqlite://')
     db.create()
     ds = db.new_dataset(vid='d111', source='source', dataset='dataset')
     self.assertTrue(ds.vid, 'd111')
예제 #6
0
 def test_creates_new_dataset(self):
     db = Database('sqlite://')
     db.create()
     ds = db.new_dataset(vid='d111', source='source', dataset='dataset')
     self.assertTrue(ds.vid, 'd111')