数据知识回调入库
This commit is contained in:
@ -1,54 +1,37 @@
|
||||
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='数据分析知识片段表';
|
||||
CREATE TABLE `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') COLLATE utf8mb4_bin NOT NULL COMMENT '动作类型',
|
||||
`status` enum('pending','running','success','failed','partial') COLLATE utf8mb4_bin NOT NULL DEFAULT 'pending' COMMENT '执行状态',
|
||||
`llm_usage` json DEFAULT NULL COMMENT 'LLM token usage统计',
|
||||
`error_code` varchar(128) COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`error_message` text COLLATE utf8mb4_bin,
|
||||
`started_at` datetime DEFAULT NULL,
|
||||
`finished_at` datetime DEFAULT NULL,
|
||||
`duration_ms` int DEFAULT NULL,
|
||||
`table_schema_version_id` varchar(19) COLLATE utf8mb4_bin NOT NULL,
|
||||
`table_schema` json NOT NULL,
|
||||
`ge_profiling_json` json DEFAULT NULL COMMENT 'Profiling完整结果JSON',
|
||||
`ge_profiling_json_size_bytes` bigint DEFAULT NULL,
|
||||
`ge_profiling_summary` json DEFAULT NULL COMMENT 'Profiling摘要(剔除大value_set等)',
|
||||
`ge_profiling_summary_size_bytes` bigint DEFAULT NULL,
|
||||
`ge_profiling_total_size_bytes` bigint DEFAULT NULL COMMENT '上两者合计',
|
||||
`ge_profiling_html_report_url` varchar(1024) COLLATE utf8mb4_bin DEFAULT NULL COMMENT 'GE报告HTML路径/URL',
|
||||
`ge_result_desc_json` json DEFAULT NULL COMMENT '表描述结果JSON',
|
||||
`ge_result_desc_json_size_bytes` bigint DEFAULT NULL,
|
||||
`snippet_json` json DEFAULT NULL COMMENT 'SQL知识片段结果JSON',
|
||||
`snippet_json_size_bytes` bigint DEFAULT NULL,
|
||||
`snippet_alias_json` json DEFAULT NULL COMMENT 'SQL片段改写/丰富结果JSON',
|
||||
`snippet_alias_json_size_bytes` bigint DEFAULT NULL,
|
||||
`callback_url` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
|
||||
`result_checksum` varbinary(32) DEFAULT 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 AUTO_INCREMENT=53 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='数据分析知识片段表';
|
||||
Reference in New Issue
Block a user