diff --git a/README.md b/README.md index 9db866e..6ca45b1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +# Notice +We strongly recommend using the [databend-driver](https://pypi.org/project/databend-driver) as it provides more comprehensive features. + + # databend-py Databend Cloud Python Driver with native http interface support diff --git a/databend_py/client.py b/databend_py/client.py index 081ab89..fad3744 100644 --- a/databend_py/client.py +++ b/databend_py/client.py @@ -77,8 +77,7 @@ def _iter_receive_result(self, query, query_id=None, with_column_types=False): ) _, rows = result.get_result() for row in rows: - for r in row: - yield r + yield row def execute( self, query, params=None, with_column_types=False, query_id=None, settings=None diff --git a/examples/iter_query.py b/examples/iter_query.py index 851943a..c943a4f 100644 --- a/examples/iter_query.py +++ b/examples/iter_query.py @@ -3,7 +3,7 @@ def iter_query(): client = Client.from_url("http://root:root@localhost:8000") - result = client.execute_iter("select 1", with_column_types=False) + result = client.execute_iter("select 1, 2, 3 from numbers(3)", with_column_types=False) result_list = [i for i in result] - # result_list is [1] + # result_list is [(1, 2, 3), (1, 2, 3), (1, 2, 3)] print(result_list) diff --git a/tests/test_client.py b/tests/test_client.py index 42cf8c7..0b48ead 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -153,12 +153,11 @@ def test_batch_insert_with_dict_multi_fields(self): def test_iter_query(self): client = Client.from_url(self.databend_url) - result = client.execute_iter("select 1", with_column_types=False) + result = client.execute_iter("select 1, 2, 3 from numbers(3)", with_column_types=False) self.assertIsInstance(result, types.GeneratorType) result_list = [i for i in result] print(result_list) - self.assertEqual(result_list, [1]) - self.assertEqual(list(result), []) + self.assertEqual(result_list, [(1, 2, 3), (1, 2, 3), (1, 2, 3)]) def test_insert(self): client = Client.from_url(self.databend_url)