本文整理汇总了Python中pybabe.Babe.push_sql方法的典型用法代码示例。如果您正苦于以下问题:Python Babe.push_sql方法的具体用法?Python Babe.push_sql怎么用?Python Babe.push_sql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybabe.Babe
的用法示例。
在下文中一共展示了Babe.push_sql方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_vectorwise
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push_sql [as 别名]
def test_vectorwise(self):
a = Babe().pull(stream=StringIO(self.s), format='csv')
a = a.typedetect()
a.push_sql(table='test_table', database_kind='vectorwise', database='pybabe_test', drop_table = True, create_table=True)
b = Babe().pull_sql(database_kind='vectorwise', database='pybabe_test', table='test_table')
buf = StringIO()
b.push(stream=buf, format='csv', delimiter=',')
self.assertEquals(buf.getvalue(), self.s)
示例2: test_pushsqlite
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push_sql [as 别名]
def test_pushsqlite(self):
a = Babe().pull(string=self.s, format='csv')
a = a.typedetect()
a.push_sql(table='test_table',
database_kind='sqlite',
database='tests/files/test.sqlite',
drop_table=True,
create_table=True)
b = Babe().pull_sql(database_kind='sqlite',
database='tests/files/test.sqlite',
table='test_table')
self.assertEquals(b.to_string(), self.s)
示例3: test_pushsqlite_partition
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push_sql [as 别名]
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)
示例4: test_vectorwise
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push_sql [as 别名]
def test_vectorwise(self):
a = Babe().pull(string=self.s,
format='csv')
a = a.typedetect()
a.push_sql(table='test_table',
database_kind='vectorwise',
database='pybabe_test',
drop_table=True,
create_table=True)
b = Babe().pull_sql(database_kind='vectorwise',
database='pybabe_test',
table='test_table')
self.assertEquals(b.to_string(), self.s)
示例5: test_pushsqlite_partition
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push_sql [as 别名]
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)