hatarist / clickhouse-cli

A third-party client for the Clickhouse DBMS server.
Other
252 stars 43 forks source link

RuntimeError: generator raised StopIteration #49

Open balta2ar opened 1 year ago

balta2ar commented 1 year ago
 :) create table twocol (call String, id String, value Int64) ENGINE = MergeTree() ORDER by (call, id)

create table twocol (call String, id String, value Int64) ENGINE = MergeTree()
 ORDER by (call, id)

Ok. 0 rows in set. Elapsed: 0.015 sec. Processed: 0 rows, 0.0B (0 rows/s, 0.0B/s)

 :) insert into twocol (call, id, value) values ('c1', 'a', 4), ('c1', 'b', 3)
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/tables.py", line 38, in extract_from_part
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/user/.local/bin/clickhouse-cli", line 8, in <module>
    sys.exit(run_cli())
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/user/.local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/cli.py", line 580, in run_cli
    cli.run(query, data_input)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/cli.py", line 291, in run
    cli_input = self.session.prompt()
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/shortcuts/prompt.py", line 1034, in prompt
    return self.app.run(
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 937, in run
    return loop.run_until_complete(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 856, in run_async
    return await _run_async2()
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 832, in _run_async2
    await self.cancel_and_wait_for_background_tasks()
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/application/application.py", line 1051, in cancel_and_wait_for_background_tasks
    await task
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/buffer.py", line 1912, in new_coroutine
    await coroutine(*a, **kw)
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/buffer.py", line 1739, in async_completer
    async for completion in self.completer.get_completions_async(
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/completion/base.py", line 271, in get_completions_async
    async for completion in completer.get_completions_async(
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/completion/base.py", line 227, in get_completions_async
    async for completion in generator_to_async_generator(
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/eventloop/async_generator.py", line 74, in generator_to_async_generator
    await runner_f
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/eventloop/async_generator.py", line 43, in runner
    for item in get_iterable():
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/completion/base.py", line 228, in <lambda>
    lambda: self.completer.get_completions(document, complete_event)
  File "/home/user/.local/lib/python3.10/site-packages/prompt_toolkit/completion/base.py", line 264, in get_completions
    return completer.get_completions(document, complete_event)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/completer.py", line 424, in get_completions
    suggestions = suggest_type(document.text, document.text_before_cursor)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/helpers.py", line 195, in suggest_type
    return suggest_based_on_last_token(stmt.last_token, stmt)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/helpers.py", line 345, in suggest_based_on_last_token
    return (Column(table_refs=stmt.get_tables('insert')),)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/helpers.py", line 145, in get_tables
    tables = extract_tables(self.full_text if scope == 'full' else self.text_before_cursor)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/tables.py", line 145, in extract_tables
    return tuple(i for i in identifiers if i.name)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/tables.py", line 145, in <genexpr>
    return tuple(i for i in identifiers if i.name)
  File "/home/user/.local/lib/python3.10/site-packages/clickhouse_cli/ui/parseutils/tables.py", line 95, in extract_table_identifiers
    for item in token_stream:
RuntimeError: generator raised StopIteration

1 → clickhouse-cli -B user -d table
clickhouse-cli version: 0.3.8
Connecting to 127.0.0.1:8123
Connected to ClickHouse server v23.1.2.

 :)