當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。