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


Python StringIO.getvalue方法代码示例

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


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

示例1: to_ddl

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def to_ddl(self):
        buf = StringIO()

        buf.write("\nROW FORMAT DELIMITED")

        if self.delimiter is not None:
            buf.write("\nFIELDS TERMINATED BY '{0}'".format(self.delimiter))

        if self.escapechar is not None:
            buf.write("\nESCAPED BY '{0}'".format(self.escapechar))

        if self.lineterminator is not None:
            buf.write("\nLINES TERMINATED BY '{0}'"
                      .format(self.lineterminator))

        buf.write("\nLOCATION '{0}'".format(self.path))

        if self.na_rep is not None:
            props = {
                'serialization.null.format': self.na_rep
            }
            buf.write('\n')
            buf.write(format_tblproperties(props))

        return buf.getvalue()
开发者ID:deepfield,项目名称:ibis,代码行数:27,代码来源:ddl.py

示例2: compile

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def compile(self):
        buf = StringIO()
        buf.write(self._create_line())

        select_query = self.select.compile()
        buf.write('\nAS\n{0}'.format(select_query))
        return buf.getvalue()
开发者ID:deepfield,项目名称:ibis,代码行数:9,代码来源:ddl.py

示例3: compile

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def compile(self):
        from ibis.expr.api import schema

        buf = StringIO()
        buf.write(self._create_line())

        def _push_schema(x):
            formatted = format_schema(x)
            buf.write('{0}'.format(formatted))

        if self.partition is not None:
            modified_schema = []
            partition_schema = []
            for name, dtype in zip(self.schema.names, self.schema.types):
                if name in self.partition:
                    partition_schema.append((name, dtype))
                else:
                    modified_schema.append((name, dtype))

            buf.write('\n')
            _push_schema(schema(modified_schema))
            buf.write('\nPARTITIONED BY ')
            _push_schema(schema(partition_schema))
        else:
            buf.write('\n')
            _push_schema(self.schema)

        format_ddl = self.table_format.to_ddl()
        if format_ddl:
            buf.write(format_ddl)

        buf.write(self._location())

        return buf.getvalue()
开发者ID:hyunsik,项目名称:ibis,代码行数:36,代码来源:ddl.py

示例4: to_ddl

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def to_ddl(self):
        import json

        buf = StringIO()
        buf.write('\nSTORED AS AVRO')
        buf.write("\nLOCATION '{0}'".format(self.path))

        schema = json.dumps(self.avro_schema, indent=2, sort_keys=True)
        schema = '\n'.join([x.rstrip() for x in schema.split('\n')])
        buf.write("\nTBLPROPERTIES ('avro.schema.literal'='{0}')"
                  .format(schema))

        return buf.getvalue()
开发者ID:hyunsik,项目名称:ibis,代码行数:15,代码来源:ddl.py

示例5: to_ddl

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def to_ddl(self):
        buf = StringIO()

        buf.write("\nROW FORMAT DELIMITED")

        if self.delimiter is not None:
            buf.write("\nFIELDS TERMINATED BY '{0}'".format(self.delimiter))

        if self.escapechar is not None:
            buf.write("\nESCAPED BY '{0}'".format(self.escapechar))

        if self.lineterminator is not None:
            buf.write("\nLINES TERMINATED BY '{0}'"
                      .format(self.lineterminator))

        buf.write("\nLOCATION '{0}'".format(self.path))

        if self.na_rep is not None:
            buf.write("\nTBLPROPERTIES('serialization.null.format'='{0}')"
                      .format(self.na_rep))

        return buf.getvalue()
开发者ID:Jackson1992,项目名称:ibis,代码行数:24,代码来源:ddl.py

示例6: test_table_info

# 需要导入模块: from ibis.compat import StringIO [as 别名]
# 或者: from ibis.compat.StringIO import getvalue [as 别名]
    def test_table_info(self):
        t = self.con.table('functional_alltypes')
        buf = StringIO()
        t.info(buf=buf)

        assert buf.getvalue() is not None
开发者ID:deepfield,项目名称:ibis,代码行数:8,代码来源:test_exprs.py


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