当前位置: 首页>>代码示例>>Python>>正文


Python Babe.push方法代码示例

本文整理汇总了Python中pybabe.Babe.push方法的典型用法代码示例。如果您正苦于以下问题:Python Babe.push方法的具体用法?Python Babe.push怎么用?Python Babe.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pybabe.Babe的用法示例。


在下文中一共展示了Babe.push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_multi2

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_multi2(self):
     a = Babe()
     a = a.pull(stream=StringIO(self.s), format='csv').pull(string=self.s, format='csv')
     a = a.merge_substreams()
     buf = StringIO()
     a.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), self.s2)
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:9,代码来源:test_base.py

示例2: test_gz

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_gz(self):
     a = Babe().pull(stream=StringIO(self.s), format='csv', name='Test')
     a.push(filename='test.csv.gz')
     b = Babe().pull(filename='test.csv.gz')
     buf = StringIO()
     b.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), self.s)
开发者ID:nizox,项目名称:PyBabe,代码行数:9,代码来源:tests.py

示例3: test_partition

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_partition(self):
     a = Babe().pull(string=self.s, format="csv")
     a = a.partition(field="date")
     d = {}
     a.push(stream_dict=d, format="csv")
     self.assertEquals(d["2012-04-04"].getvalue(), "date,name,value\n2012-04-04,John,1\n2012-04-04,Luke,2\n")
     self.assertEquals(d["2012-04-05"].getvalue(), "date,name,value\n2012-04-05,John,1\n")
开发者ID:fdouetteau,项目名称:PyBabe,代码行数:9,代码来源:test_partition.py

示例4: test_bulk

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [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"])
     buf = StringIO()
     a.push(stream=buf, format="csv")
     self.assertEquals(buf.getvalue(), self.s2)
开发者ID:nizox,项目名称:PyBabe,代码行数:9,代码来源:tests.py

示例5: test_twitter

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [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')
开发者ID:nizox,项目名称:PyBabe,代码行数:9,代码来源:tests.py

示例6: test_replace

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_replace(self):
     a = Babe().pull(filename='tests/test.csv', name='Test').typedetect()
     a = a.mapTo(lambda row : [row.foo+1, row.bar*2], fields=['a','b'])
     buf = StringIO()
     a.push(stream=buf, format='csv')
     s = """a,b\n2,4\n4,8\n"""
     self.assertEquals(buf.getvalue(), s)
开发者ID:nizox,项目名称:PyBabe,代码行数:9,代码来源:tests.py

示例7: test_s3

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
    def test_s3(self):
        s = "a,b\n1,a\n3,b\n"
        filename = 'tests/test_bq.csv'
        a = Babe().pull(string=s,
                        format='csv',
                        name='Test')

        a.push(filename=filename,
               format='csv',
               delimiter='\t',
               quotechar='|',
               encoding='utf8',
               bucket='bertrandtest',
               protocol='gs')

        b = Babe()

        b.push_bigquery(filename=filename,
                        bucket='bertrandtest',
                        project_id='bigquery-testing-1098',
                        dataset_id='ladata',
                        table_name='tests',
                        schema=[
                            {
                                "name": "entier",
                                "type": "INTEGER",
                                "mode": "REQUIRED"
                            },
                            {
                                "name": "string",
                                "type": "STRING",
                                "mode": "REQUIRED"
                            }
                        ])
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:36,代码来源:test_bigquery.py

示例8: test_zip

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_zip(self):
     babe = Babe()
     a = babe.pull(stream=StringIO(self.s), format="csv")
     a.push(filename='tests/test.zip')
     b = Babe().pull(filename='tests/test.zip')
     buf = StringIO()
     b.push(stream=buf)
     self.assertEquals(buf.getvalue(), self.s)
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例9: test_load

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_load(self):
     start_time = '2012-04-23 11:00'
     end_time = '2012-04-23 12:00'
     a = Babe().pull_kontagent(start_time, end_time, sample_mode=True)
     buf = StringIO()
     a = a.head(n=10)
     a.push(stream=buf, format='csv')
     print buf.getvalue()
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例10: test_vectorwise

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [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)
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例11: test_buzzdata

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_buzzdata(self):
     a = Babe().pull(protocol='buzzdata', 
             dataroom='best-city-contest-worldwide-cost-of-living-index',
             uuid='aINAPyLGur4y37yAyCM7w3', 
              username='eiu', format='xls')
     a = a.head(2)
     buf = StringIO()
     a.push(stream=buf, format='csv')
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例12: test_pushpull

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [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)      
开发者ID:nizox,项目名称:PyBabe,代码行数:10,代码来源:tests.py

示例13: test_load_partition

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_load_partition(self):
     start_time = "2012-04-23 11:00"
     end_time = "2012-04-23 12:00"
     a = Babe().pull_kontagent(start_time, end_time, sample_mode=True)
     a = a.head(n=10)
     d = {}
     a.push(stream_dict=d, format="csv")
     self.assertEquals(list(d.keys()), ["2012-04-23_11"])
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:10,代码来源:test_kontagent.py

示例14: test_s3_glob2

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_s3_glob2(self):
     s = "a,b\n1,2\n3,4\n"
     buf1 = StringIO(s)
     a = Babe().pull(stream=buf1, format='csv', name='Test')
     a.push(filename='foofoobar/test_glob_4.csv', bucket='florian-test', protocol="s3") 
     b = Babe().pull(filename='foofoobar/test_glob_?.csv', name='Test', bucket='florian-test', protocol="s3")
     buf = StringIO() 
     b.push(stream=buf, format='csv')
     self.assertEquals(buf.getvalue(), s)
开发者ID:nizox,项目名称:PyBabe,代码行数:11,代码来源:tests.py

示例15: test_s3

# 需要导入模块: from pybabe import Babe [as 别名]
# 或者: from pybabe.Babe import push [as 别名]
 def test_s3(self):
     s = "a,b\n1,2\n3,4\n"
     a = Babe().pull(string=s,
                     format='csv',
                     name='Test')
     a.push(filename='test_gs.csv',
            bucket='bertrandtest',
            delimiter="\t",
            protocol="gs")
开发者ID:IsCoolEntertainment,项目名称:PyBabe,代码行数:11,代码来源:test_google_storage.py


注:本文中的pybabe.Babe.push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。