featzhang created FLINK-39068:
---------------------------------
Summary: [SQL Client] Support saving and exporting SQL execution
history
Key: FLINK-39068
URL: https://issues.apache.org/jira/browse/FLINK-39068
Project: Flink
Issue Type: New Feature
Components: Table SQL / Client
Reporter: featzhang
Currently, the Flink SQL Client does not persist or expose a history of
executed SQL statements. Users working in interactive mode lose their command
history upon exit, and there is no built-in way to review, export, or audit
previously run queries.
This limitation impacts: * {*}Developer productivity{*}: No easy way to recall
or reuse past queries.
* {*}Debugging & auditing{*}: Hard to trace what SQL was executed during a
session.
* {*}Reproducibility{*}: Queries are often lost if not manually saved to
external files.
h4. Proposed Feature
Add support for: # *Automatically saving executed SQL statements* to a local
history file (e.g., {{{}~/.flink-sql-history{}}}), similar to {{.bash_history}}
or {{{}.mysql_history{}}}.
# *Command-line option or SQL client command* to list/export history (e.g.,
{{SHOW HISTORY;}} or {{{}sql-client.sh --history{}}}).
# *Configurable history size and location* via {{sql-client-defaults.yaml}} or
environment variable.
h4. Expected Behavior
* In embedded/interactive mode, every successfully parsed/executed SQL
statement is appended to a history file.
* On startup, SQL Client loads history and enables navigation via ↑/↓ keys
(already partially works in-memory; this makes it persistent).
* Optional: Support exporting history to a file for sharing or backup.
h4. Related Systems
* MySQL/PostgreSQL CLI clients save query history by default.
* Spark SQL CLI ({{{}spark-sql{}}}) supports {{{}.spark-sql-history{}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)