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