Ejemplo n.º 1
0
    def test_pushsqlite_partition(self):
        a = Babe().pull(string=self.s, format='csv')
        a = a.typedetect()
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', drop_table = True, create_table=True)

        a = Babe().pull(string=self.s2, format='csv')
        a = a.typedetect()
        a = a.partition(field='id')
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', delete_partition=True)

        b = Babe().pull_sql(database_kind='sqlite', database='test.sqlite', table='test_table')
        b = b.sort(field="id")
        self.assertEquals(b.to_string(), self.sr)
Ejemplo n.º 2
0
    def test_pushsqlite_partition(self):
        a = Babe().pull(stream=StringIO(self.s), format='csv')
        a = a.typedetect()
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', drop_table = True, create_table=True)

        a = Babe().pull(stream=StringIO(self.s2), format='csv')
        a = a.typedetect()
        a = a.partition(field='id')
        a.push_sql(table='test_table', database_kind='sqlite', database='test.sqlite', delete_partition=True)

        b = Babe().pull_sql(database_kind='sqlite', database='test.sqlite', table='test_table')
        b = b.sort(field="id")
        buf = StringIO()
        b.push(stream=buf, format='csv', delimiter=',')
        self.assertEquals(buf.getvalue(), self.sr)
Ejemplo n.º 3
0
    def test_pushsqlite_partition(self):
        a = Babe().pull(string=self.s, format='csv')
        a = a.typedetect()
        a.push_sql(table='test_table',
                   database_kind='sqlite',
                   database='test.sqlite',
                   drop_table=True,
                   create_table=True)

        a = Babe().pull(string=self.s2, format='csv')
        a = a.typedetect()
        a = a.partition(field='id')
        a.push_sql(table='test_table',
                   database_kind='sqlite',
                   database='test.sqlite',
                   delete_partition=True)

        b = Babe().pull_sql(database_kind='sqlite',
                            database='test.sqlite',
                            table='test_table')
        b = b.sort(field="id")
        self.assertEquals(b.to_string(), self.sr)
Ejemplo n.º 4
0
    def test_pushsqlite_partition(self):
        a = Babe().pull(stream=StringIO(self.s), format='csv')
        a = a.typedetect()
        a.push_sql(table='test_table',
                   database_kind='sqlite',
                   database='test.sqlite',
                   drop_table=True,
                   create_table=True)

        a = Babe().pull(stream=StringIO(self.s2), format='csv')
        a = a.typedetect()
        a = a.partition(field='id')
        a.push_sql(table='test_table',
                   database_kind='sqlite',
                   database='test.sqlite',
                   delete_partition=True)

        b = Babe().pull_sql(database_kind='sqlite',
                            database='test.sqlite',
                            table='test_table')
        b = b.sort(field="id")
        buf = StringIO()
        b.push(stream=buf, format='csv', delimiter=',')
        self.assertEquals(buf.getvalue(), self.sr)