Skip to content

Commit

Permalink
Fix get_inner_columns_with_types trailing space #385
Browse files Browse the repository at this point in the history
  • Loading branch information
xzkostyan committed Aug 8, 2024
1 parent 1e4291c commit 29b9d91
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clickhouse_driver/columns/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ def get_inner_columns(spec):


def get_inner_columns_with_types(spec):
spec = spec.strip()
brackets = 0
prev_comma = 0
prev_space = 0

columns = []
for i, x in enumerate(spec + ','):
for i, x in enumerate(spec.strip() + ','):
if x == ',':
if brackets == 0:
columns.append((
Expand Down
8 changes: 8 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from clickhouse_driver.columns.util import get_inner_columns_with_types


def test_get_inner_columns_with_types_empty_spaces():
assert (
get_inner_columns_with_types('\n test String\n ') ==
[('test', 'String')]
)

0 comments on commit 29b9d91

Please sign in to comment.