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

feat: new CLI parameter (-f,--file) to execute commands from a file #6440

Merged
merged 1 commit into from
Oct 22, 2020

Conversation

spena
Copy link
Member

@spena spena commented Oct 15, 2020

Description

What behavior do you want to change, why, how does your patch achieve the changes?
Adds a new command parameter to execute commands from a file and exit.

$ cat /tmp/test.sql 
SHOW STREAMS;
LIST TOPICS;

$ ./bin/ksql -f /tmp/test.sql 
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.

SHOW STREAMS;
 Stream Name         | Kafka Topic                 | Key Format | Value Format | Windowed 
------------------------------------------------------------------------------------------
 KSQL_PROCESSING_LOG | default_ksql_processing_log | KAFKA      | JSON         | false    
------------------------------------------------------------------------------------------

LIST TOPICS;
 Kafka Topic                 | Partitions | Partition Replicas 
---------------------------------------------------------------
 default_ksql_processing_log | 1          | 1                  
 topic1                      | 1          | 1                  
---------------------------------------------------------------

$

It leverages the RunScript class (used by the RUN SCRIPT command), which loads all commands from a file and make one single ksqlDB request with all the commands.

Testing done

Describe the testing strategy. Unit and integration tests are expected for any behavior changes.
Added unit tests
Verified manually

Reviewer checklist

  • Ensure docs are updated if necessary. (eg. if a user visible feature is being added or changed).
  • Ensure relevant issues are linked (description should include text like "Fixes #")

@spena spena requested a review from a team October 15, 2020 15:43
@spena spena force-pushed the cli_file_param branch 2 times, most recently from 00ece86 to ae3d929 Compare October 22, 2020 13:10
Copy link
Member

@stevenpyzhang stevenpyzhang left a comment

Choose a reason for hiding this comment

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

lgtm, but looks like one of the tests you added is failing

@spena spena merged commit 0e03a38 into confluentinc:master Oct 22, 2020
@spena spena deleted the cli_file_param branch October 22, 2020 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants