Skip to content

Commit

Permalink
Fix insert large string (#388)
Browse files Browse the repository at this point in the history
* Fix insert large string

* Updated CHANGELOG.md

* Update version
  • Loading branch information
bakwc authored Aug 21, 2024
1 parent 2ee0e4b commit 58fbbc1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ release (0.8.0), unrecognized arguments/keywords for these methods of creating a
instead of being passed as ClickHouse server settings. This is in conjunction with some refactoring in Client construction.
The supported method of passing ClickHouse server settings is to prefix such arguments/query parameters with`ch_`.

## 0.7.19, 2024-08-23
### Bug Fix
- Insertion of large strings was triggering an exception. This has been fixed.

## 0.7.18, 2024-07-30
### Bug Fix
- In some cases retrieving the os_user as part of the `client data` in the HTTP User-Agent header could throw an exception. This
Expand Down
2 changes: 1 addition & 1 deletion clickhouse_connect/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.7.18'
version = '0.7.19'
3 changes: 2 additions & 1 deletion clickhouse_connect/driver/insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def _calc_block_size(self) -> int:
sample = [data[j][i] for j in range(0, self.row_count, sample_freq)]
d_size = d_type.data_size(sample)
row_size += d_size
return 1 << (21 - int(log(row_size, 2)))
shift_size = (21 - int(log(row_size, 2)))
return 1 if shift_size < 0 else 1 << (21 - int(log(row_size, 2)))

def next_block(self) -> Generator[InsertBlock, None, None]:
while True:
Expand Down

0 comments on commit 58fbbc1

Please sign in to comment.