本文整理汇总了Python中pybabe.Babe.typedetect方法的典型用法代码示例。如果您正苦于以下问题:Python Babe.typedetect方法的具体用法?Python Babe.typedetect怎么用?Python Babe.typedetect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybabe.Babe
的用法示例。
在下文中一共展示了Babe.typedetect方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_pushsqlite_partition
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [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)
示例2: test_pushsqlite_partition
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [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)
示例3: test_bulk
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_bulk(self):
a = Babe().pull(stream=StringIO(self.s), format="csv")
a = a.typedetect()
a = a.bulkMapTo(lambda list: [[sum([r.a for r in list])]] * len(list),
bulk_size=2,
insert_fields=["b"])
self.assertEquals(a.to_string(), self.s2)
示例4: test_twitter
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_twitter(self):
a = Babe().pull_twitter()
a = a.filterColumns(keep_fields=
["author_name", "author_id", "author_screen_name", "created_at", "hashtags", "text", "in_reply_to_status_id_str"])
a = a.typedetect()
buf = StringIO()
a.push(stream=buf, format='csv')
示例5: test_vectorwise
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [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)
示例6: test_pushpull
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_pushpull(self):
a = Babe().pull(stream=StringIO(self.s2), format='csv', primary_key='rown')
a = a.typedetect()
a.push_mongo(db='pybabe_test',collection='test_pushpull', drop_collection=True)
b = Babe().pull_mongo(db="pybabe_test", fields=['rown', 'f', 's'], collection='test_pushpull')
buf = StringIO()
b.push(stream=buf, format='csv')
self.assertEquals(buf.getvalue(), self.s2)
示例7: test_pushsqlite
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [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)
示例8: test_vectorwise
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [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)
示例9: test_pushpull
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_pushpull(self):
a = Babe().pull(string=self.s2, format="csv", primary_key="rown")
a = a.typedetect()
a.push_mongo(db="pybabe_test", collection="test_pushpull", drop_collection=True)
b = Babe().pull_mongo(db="pybabe_test", fields=["rown", "f", "s"], collection="test_pushpull")
self.assertEquals(b.to_string(), self.s2)
示例10: test_push
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_push(self):
a = Babe().pull(string=self.s1, format="csv", primary_key="rown")
a = a.typedetect()
a.push_mongo(db="pybabe_test", collection="test_push")
示例11: test_push
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_push(self):
a = Babe().pull(string=self.s1, format='csv', primary_key='rown')
a = a.typedetect()
a.push_mongo(db='pybabe_test',collection='test_push')
示例12: test_pushpull
# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import typedetect [as 别名]
def test_pushpull(self):
a = Babe().pull(string=self.s2, format='csv', primary_key='rown')
a = a.typedetect()
a.push_mongo(db='pybabe_test',collection='test_pushpull', drop_collection=True)
b = Babe().pull_mongo(db="pybabe_test", fields=['rown', 'f', 's'], collection='test_pushpull')
self.assertEquals(b.to_string(), self.s2)