Files
data-ge/table_snippet.sql
2025-11-04 20:28:50 +08:00

37 lines
2.4 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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='数据分析知识片段表';