Skip to content

Commit

Permalink
Merge pull request #327 from carlosfy/326-fix-handle-progress-packet
Browse files Browse the repository at this point in the history
Fix handle Progress packet while insert from input (#326)
  • Loading branch information
xzkostyan committed Aug 26, 2022
2 parents 9903ca6 + 792df1a commit 47dd88e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clickhouse_driver/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,9 @@ def receive_end_of_query(self):
if packet.type == ServerPacketTypes.END_OF_STREAM:
break

elif packet.type == ServerPacketTypes.PROGRESS:
continue

elif packet.type == ServerPacketTypes.EXCEPTION:
raise packet.exception

Expand Down
15 changes: 15 additions & 0 deletions tests/test_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from tests.testcase import BaseTestCase
from clickhouse_driver import errors
from clickhouse_driver.errors import ServerException
from tests.util import require_server_version


class InsertTestCase(BaseTestCase):
Expand Down Expand Up @@ -148,6 +149,20 @@ def test_insert_return(self):
)
self.assertEqual(rv, 5)

@require_server_version(22, 3, 6)
def test_insert_from_input(self):
with self.create_table('a Int8'):
data = [{'a': 1}]
self.client.execute(
"INSERT INTO test (a) "
"SELECT a from input ('a Int8')",
data
)

query = 'SELECT * FROM test'
inserted = self.emit_cli(query)
self.assertEqual(inserted, '1\n')


class InsertColumnarTestCase(BaseTestCase):
def test_insert_tuple_ok(self):
Expand Down

0 comments on commit 47dd88e

Please sign in to comment.