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 WITH(id = '<query-id>') clause to INSERT/SELECT #6533

Closed
spena opened this issue Oct 27, 2020 · 0 comments
Closed

feat: new WITH(id = '<query-id>') clause to INSERT/SELECT #6533

spena opened this issue Oct 27, 2020 · 0 comments
Assignees
Milestone

Comments

@spena
Copy link
Member

spena commented Oct 27, 2020

Is your feature request related to a problem? Please describe.
There is a discussion about removing the INSERT/SELECT command from ksqlDB (see KLIP-17). The discussion does not have an agreement yet. However, users are still using the INSERT/SELECT in their environments, and there is not good experience when using this command in SQL scripts, especially when terminating the INSERT/SELECT queries.

When a user executes an INSERT/SELECT command, ksqlDB registers the query with the INSERT_{randomN} ID. To terminate the query, the user must know this {randomN}. ksqlDB uses an algorithm to get this number based on the command topic offset. Users might able to guess this and use it in their SQL scripts, but this is not a good user experience when working with SQL scripts and migrations.

Describe the solution you'd like
To help users terminate INSERT/SELECT queries from their SQL scripts without guessing the {randomN}, we should let them choose an appropriate query ID they want to use, and let them terminate the query with such ID.

For example:

INSERT INTO s1 WITH(ID='my-insert-1') SELECT * FROM s0;
TERMINATE 'my-insert-1';

With this approach, users could have the following benefits:

  • Give a meaning to the query ID, such as insert_missing_rows, insert_valid_metrics, etc.
  • Terminate queries without knowing the {randomN} (very useful when working with SQL scripts)

It is desired that the new ID is displayed by SHOW QUERIES too. I don't know if this new ID should replace the INSERT_{randomN} ID or just use as an alias.

@spena spena added this to the 0.15.0 milestone Oct 27, 2020
@spena spena self-assigned this Oct 27, 2020
@spena spena changed the title feat: new WITH(id = '<query-id-name>') clause to INSERT/SELECT feat: new WITH(id = '<query-id>') clause to INSERT/SELECT Oct 27, 2020
@spena spena closed this as completed Nov 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant