RUN SCRIPT <path-to-query-file>;
You can run a list of predefined queries and commands from in a file by using the RUN SCRIPT command.
The RUN SCRIPT command supports a subset of ksqlDB statements:
- Persistent queries: CREATE STREAM, CREATE TABLE, CREATE STREAM AS SELECT, CREATE TABLE AS SELECT
- DROP STREAM and DROP TABLE
- SET, UNSET statements
- INSERT INTO statement
The RUN SCRIPT doesn't support statements such as:
- SHOW TOPICS and SHOW STREAMS, etc.
- Non-persistent queries: SELECT, etc.
RUN SCRIPT can also be used from the command line, for instance when writing shell scripts. For more information, see Running ksqlDB Statements From the Command Line.
The following statement runs the queries in the file located at
RUN SCRIPT '/local/path/to/queries.sql';