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


Python PrestoClient.get_rows方法代码示例

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


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

示例1: test_retrieve_rows

# 需要导入模块: from prestoadmin.prestoclient import PrestoClient [as 别名]
# 或者: from prestoadmin.prestoclient.PrestoClient import get_rows [as 别名]
    def test_retrieve_rows(self, mock_uri, mock_get_from_uri, mock_port):
        mock_port.return_value = 8080
        client = PrestoClient('any_host', 'any_user')
        dir = os.path.abspath(os.path.dirname(__file__))

        with open(dir + '/resources/valid_rest_response_level1.txt') \
                as json_file:
            client.response_from_server = json.load(json_file)
        mock_get_from_uri.return_value = True
        mock_uri.side_effect = [
            "http://localhost:8080/v1/statement/2015_harih/2", ""
        ]

        self.assertEqual(client.get_rows(), [])
        self.assertEqual(client.next_uri,
                         "http://localhost:8080/v1/statement/2015_harih/2")

        with open(dir + '/resources/valid_rest_response_level2.txt') \
                as json_file:
            client.response_from_server = json.load(json_file)
        mock_uri.side_effect = [
            "http://localhost:8080/v1/statement/2015_harih/2", ""
        ]

        expected_row = [["uuid1", "http://localhost:8080", "presto-main:0.97",
                         True],
                        ["uuid2", "http://worker:8080", "presto-main:0.97",
                         False]]
        self.assertEqual(client.get_rows(), expected_row)
        self.assertEqual(client.next_uri, "")
开发者ID:Teradata,项目名称:presto-admin,代码行数:32,代码来源:test_prestoclient.py

示例2: test_limit_rows

# 需要导入模块: from prestoadmin.prestoclient import PrestoClient [as 别名]
# 或者: from prestoadmin.prestoclient.PrestoClient import get_rows [as 别名]
    def test_limit_rows(self, mock_uri, mock_get_from_uri):
        client = PrestoClient('any_host', 'any_user', 8080)
        dir = os.path.abspath(os.path.dirname(__file__))
        with open(dir + '/files/valid_rest_response_level2.txt') as json_file:
            client.response_from_server = json.load(json_file)
        mock_get_from_uri.return_value = True
        mock_uri.side_effect = ["any_next_uri", ""]

        self.assertEqual(client.get_rows(0), [])
开发者ID:Svjard,项目名称:presto-admin,代码行数:11,代码来源:test_prestoclient.py

示例3: test_append_rows

# 需要导入模块: from prestoadmin.prestoclient import PrestoClient [as 别名]
# 或者: from prestoadmin.prestoclient.PrestoClient import get_rows [as 别名]
    def test_append_rows(self, mock_uri, mock_get_from_uri):
        client = PrestoClient('any_host', 'any_user', 8080)
        dir = os.path.abspath(os.path.dirname(__file__))

        with open(dir + '/files/valid_rest_response_level2.txt') as json_file:
            client.response_from_server = json.load(json_file)
        mock_get_from_uri.return_value = True
        mock_uri.side_effect = ["any_next_uri", "any_next_next_uri", "", ""]
        expected_row = [["uuid1", "http://localhost:8080", "presto-main:0.97",
                         True],
                        ["uuid2", "http://worker:8080", "presto-main:0.97",
                         False],
                        ["uuid1", "http://localhost:8080", "presto-main:0.97",
                         True],
                        ["uuid2", "http://worker:8080",  "presto-main:0.97",
                         False]]
        self.assertEqual(client.get_rows(), expected_row)
开发者ID:Svjard,项目名称:presto-admin,代码行数:19,代码来源:test_prestoclient.py


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