From 72f406eb5bfd69647b3fdb9052f336c688cb124c Mon Sep 17 00:00:00 2001 From: hantmac Date: Sat, 11 Mar 2023 21:50:53 +0800 Subject: [PATCH 1/2] fix: fetch more pages until next_url is None --- databend_py/client.py | 4 ---- tests/test_client.py | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/databend_py/client.py b/databend_py/client.py index 428dde2..bae36af 100644 --- a/databend_py/client.py +++ b/databend_py/client.py @@ -30,14 +30,10 @@ def disconnect_connection(self): self.connection.disconnect() def data_generator(self, raw_data): - while raw_data['next_uri'] is not None: try: raw_data = self.receive_data(raw_data['next_uri']) - if not raw_data['data']: - break yield raw_data - except (Exception, KeyboardInterrupt): self.disconnect() raise diff --git a/tests/test_client.py b/tests/test_client.py index a7b31c6..ae0667b 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -43,6 +43,7 @@ def test_ordinary_query(self): _, r = c.execute("select 1", with_column_types=False) self.assertEqual(r, ([(1,)])) column_types, _ = c.execute(select_test, with_column_types=True) + print(column_types) self.assertEqual(column_types, [('db', 'NULL'), ('name', 'String'), ('schema', 'String'), ('type', 'String')]) # test with_column_types=True From b60e628ce9d02ac58c63cbf02151d71cb9b0c9e6 Mon Sep 17 00:00:00 2001 From: hantmac Date: Sat, 11 Mar 2023 21:55:32 +0800 Subject: [PATCH 2/2] fix --- tests/test_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_client.py b/tests/test_client.py index ae0667b..9e45462 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -82,7 +82,7 @@ def tearDown(self): if __name__ == '__main__': print("start test......") - os.environ['TEST_DATABEND_DSN'] = "http://root:@localhost:8002" + # os.environ['TEST_DATABEND_DSN'] = "http://root:@localhost:8002" dt = DatabendPyTestCase(databend_url=os.getenv("TEST_DATABEND_DSN")) dt.test_simple() dt.test_ordinary_query()