Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Merge pull request #93 from sundy-li/notice-databend-driver
Browse files Browse the repository at this point in the history
notice databend-driver
  • Loading branch information
hantmac authored Jan 14, 2025
2 parents 246e2c5 + 9f990f4 commit 71e69b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions databend_py/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/iter_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 2 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 71e69b3

Please sign in to comment.