55 lines
2.2 KiB
SQL
55 lines
2.2 KiB
SQL
CREATE TABLE IF NOT EXISTS action_results (
|
||
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||
table_id BIGINT NOT NULL COMMENT '表ID',
|
||
version_ts BIGINT NOT NULL COMMENT '版本时间戳(版本号)',
|
||
action_type ENUM('ge_profiling','ge_result_desc','snippet','snippet_alias') NOT NULL COMMENT '动作类型',
|
||
|
||
status ENUM('pending','running','success','failed','partial') NOT NULL DEFAULT 'pending' COMMENT '执行状态',
|
||
error_code VARCHAR(128) NULL,
|
||
error_message TEXT NULL,
|
||
|
||
-- 回调 & 观测
|
||
callback_url VARCHAR(1024) NOT NULL,
|
||
started_at DATETIME NULL,
|
||
finished_at DATETIME NULL,
|
||
duration_ms INT NULL,
|
||
|
||
-- 本次schema信息
|
||
table_schema_version_id BIGINT NOT NULL,
|
||
table_schema JSON NOT NULL,
|
||
|
||
-- ===== 动作1:GE Profiling =====
|
||
ge_profiling_full JSON NULL COMMENT 'Profiling完整结果JSON',
|
||
ge_profiling_full_size_bytes BIGINT NULL,
|
||
ge_profiling_summary JSON NULL COMMENT 'Profiling摘要(剔除大value_set等)',
|
||
ge_profiling_summary_size_bytes BIGINT NULL,
|
||
ge_profiling_total_size_bytes BIGINT NULL COMMENT '上两者合计',
|
||
ge_profiling_html_report_url VARCHAR(1024) NULL COMMENT 'GE报告HTML路径/URL',
|
||
|
||
-- ===== 动作2:GE Result Desc =====
|
||
ge_result_desc_full JSON NULL COMMENT '表描述结果JSON',
|
||
ge_result_desc_full_size_bytes BIGINT NULL,
|
||
|
||
-- ===== 动作3:Snippet 生成 =====
|
||
snippet_full JSON NULL COMMENT 'SQL知识片段结果JSON',
|
||
snippet_full_size_bytes BIGINT NULL,
|
||
|
||
-- ===== 动作4:Snippet Alias 改写 =====
|
||
snippet_alias_full JSON NULL COMMENT 'SQL片段改写/丰富结果JSON',
|
||
snippet_alias_full_size_bytes BIGINT NULL,
|
||
|
||
-- 通用可选指标
|
||
result_checksum VARBINARY(32) NULL COMMENT '对当前action有效载荷计算的MD5/xxhash',
|
||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||
|
||
PRIMARY KEY (id),
|
||
UNIQUE KEY uq_table_ver_action (table_id, version_ts, action_type),
|
||
KEY idx_status (status),
|
||
KEY idx_table (table_id, updated_at),
|
||
KEY idx_action_time (action_type, version_ts),
|
||
KEY idx_schema_version (table_schema_version_id)
|
||
) ENGINE=InnoDB
|
||
ROW_FORMAT=DYNAMIC
|
||
COMMENT='数据分析知识片段表';
|