Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clickhouse client/local interactive: support \i file #38813

Merged
merged 3 commits into from
Jul 4, 2022

Conversation

kssenii
Copy link
Member

@kssenii kssenii commented Jul 4, 2022

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Support \i file in clickhouse client / local (similar to psql \i).

@robot-clickhouse robot-clickhouse added the pr-improvement Pull request with some product improvements label Jul 4, 2022
@kssenii kssenii changed the title clickhouse client/local \i file option clickhouse client/local interactive: support \i file Jul 4, 2022
return false;

if (trimmed_input.starts_with("\\i"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. But is it possible to group the code with others (backslash_aliases)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do that at first, but switched to current way as backslash_aliases just rewrite input text while for \i need a different code for execution of queries so it seemed better to put this inside processQueryText.

spawn bash -c "source $basedir/../shell_config.sh ; \$CLICKHOUSE_CLIENT --disable_suggestion"
expect ":) "

send -- "\\i queries_02352\r"
Copy link
Member

@alexey-milovidov alexey-milovidov Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also add a case with \i queries_02352; (semicolon is trimmed) as well as

\i   a file with whitespace       ;

(extra whitespaces in the beginning and at the end trimmed, other preserved)

@alexey-milovidov alexey-milovidov self-assigned this Jul 4, 2022
@alexey-milovidov alexey-milovidov merged commit c5cf61b into ClickHouse:master Jul 4, 2022
yokofly added a commit to timeplus-io/proton that referenced this pull request Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-improvement Pull request with some product improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants