(improvement)(project) support explain in semantic and show explain sql in web and fix chat start error (#103)

This commit is contained in:
lexluo09
2023-09-19 16:38:24 +08:00
committed by GitHub
parent 13dcf0edb9
commit a94a44826b
17 changed files with 367 additions and 110 deletions

View File

@@ -1,3 +1,4 @@
-- chat tables
CREATE TABLE IF NOT EXISTS `s2_chat_context`
(
`chat_id` BIGINT NOT NULL , -- context chat id
@@ -7,7 +8,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat_context`
`semantic_parse` LONGVARCHAR DEFAULT NULL , -- parse data
`ext_data` LONGVARCHAR DEFAULT NULL , -- extend data
PRIMARY KEY (`chat_id`)
);
);
CREATE TABLE IF NOT EXISTS `s2_chat`
(
@@ -21,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `s2_chat`
`is_delete` INT DEFAULT '0' COMMENT 'is deleted',
`is_top` INT DEFAULT '0' COMMENT 'is top',
PRIMARY KEY (`chat_id`)
) ;
) ;
CREATE TABLE `s2_chat_query`
@@ -64,72 +65,21 @@ CREATE TABLE `s2_chat_statistics`
);
CREATE TABLE IF NOT EXISTS `s2_chat_config` (
`id` INT NOT NULL AUTO_INCREMENT,
`model_id` INT DEFAULT NULL ,
`chat_detail_config` varchar(655) ,
`id` INT NOT NULL AUTO_INCREMENT,
`model_id` INT DEFAULT NULL ,
`chat_detail_config` varchar(655) ,
`chat_agg_config` varchar(655) ,
`recommended_questions` varchar(1500) ,
`recommended_questions` varchar(1500) ,
`created_at` TIMESTAMP NOT NULL ,
`updated_at` TIMESTAMP NOT NULL ,
`created_by` varchar(100) NOT NULL ,
`updated_by` varchar(100) NOT NULL ,
`status` INT NOT NULL DEFAULT '0' , -- domain extension information status : 0 is normal, 1 is off the shelf, 2 is deleted
PRIMARY KEY (`id`)
) ;
-- CREATE TABLE IF NOT EXISTS `s2_chat_config` (
-- `id` INT NOT NULL AUTO_INCREMENT,
-- `domain_id` INT DEFAULT NULL ,
-- `default_metrics` varchar(655) DEFAULT NULL,
-- `visibility` varchar(655) , -- invisible dimension metric information
-- `entity_info` varchar(655) ,
-- `dictionary_info` varchar(655) , -- dictionary-related dimension setting information
-- `created_at` TIMESTAMP NOT NULL ,
-- `updated_at` TIMESTAMP NOT NULL ,
-- `created_by` varchar(100) NOT NULL ,
-- `updated_by` varchar(100) NOT NULL ,
-- `status` INT NOT NULL DEFAULT '0' , -- domain extension information status : 0 is normal, 1 is off the shelf, 2 is deleted
-- PRIMARY KEY (`id`)
-- ) ;
) ;
COMMENT ON TABLE s2_chat_config IS 'chat config information table ';
CREATE TABLE IF NOT EXISTS `s2_dictionary` (
`id` INT NOT NULL AUTO_INCREMENT,
`domain_id` INT NOT NULL ,
`dim_value_infos` LONGVARCHAR , -- dimension value setting information
`created_at` TIMESTAMP NOT NULL ,
`updated_at` TIMESTAMP NOT NULL ,
`created_by` varchar(100) NOT NULL ,
`updated_by` varchar(100) DEFAULT NULL ,
`status` INT NOT NULL DEFAULT '0' , -- domain extension information status : 0 is normal, 1 is off the shelf, 2 is deleted
PRIMARY KEY (`id`),
UNIQUE (domain_id)
);
COMMENT ON TABLE s2_dictionary IS 'dictionary configuration information table';
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL , -- task name
`description` varchar(255) ,
`command`LONGVARCHAR NOT NULL , -- task Request Parameters
`command_md5` varchar(255) NOT NULL , -- task Request Parameters md5
`dimension_ids` varchar(500) ,
`status` INT NOT NULL , -- the final status of the task
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
`created_by` varchar(100) NOT NULL ,
`progress` DOUBLE default 0.00 , -- task real-time progress
`elapsed_ms` bigINT DEFAULT NULL , -- the task takes time in milliseconds
`message` LONGVARCHAR , -- remark related information
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';
create table s2_user
(
id INT AUTO_INCREMENT,
@@ -141,6 +91,28 @@ create table s2_user
);
COMMENT ON TABLE s2_user IS 'user information table';
CREATE TABLE IF NOT EXISTS `s2_semantic_pasre_info` (
`id` INT NOT NULL AUTO_INCREMENT,
`trace_id` varchar(200) NOT NULL ,
`model_id` INT NOT NULL ,
`dimensions`LONGVARCHAR ,
`metrics`LONGVARCHAR ,
`orders`LONGVARCHAR ,
`filters`LONGVARCHAR ,
`date_info`LONGVARCHAR ,
`limit` INT NOT NULL ,
`native_query` TINYINT NOT NULL DEFAULT '0' ,
`sql`LONGVARCHAR ,
`created_at` TIMESTAMP NOT NULL ,
`created_by` varchar(100) NOT NULL ,
`status` INT NOT NULL ,
`elapsed_ms` bigINT DEFAULT NULL ,
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_semantic_pasre_info IS 'semantic layer sql parsing information table';
CREATE TABLE IF NOT EXISTS `s2_plugin`
(
`id` INT AUTO_INCREMENT,
@@ -157,5 +129,50 @@ CREATE TABLE IF NOT EXISTS `s2_plugin`
`config` LONGVARCHAR NULL,
`comment` LONGVARCHAR NULL,
PRIMARY KEY (`id`)
); COMMENT ON TABLE s2_plugin IS 'plugin information table';
); COMMENT ON TABLE s2_plugin IS 'plugin information table';
CREATE TABLE IF NOT EXISTS s2_agent
(
id int AUTO_INCREMENT,
name varchar(100) null,
description varchar(500) null,
status int null,
examples varchar(500) null,
config varchar(2000) null,
created_by varchar(100) null,
created_at TIMESTAMP null,
updated_by varchar(100) null,
updated_at TIMESTAMP null,
enable_search int null,
PRIMARY KEY (`id`)
); COMMENT ON TABLE s2_agent IS 'agent information table';
-------demo for semantic and chat
CREATE TABLE IF NOT EXISTS `s2_user_department` (
`user_name` varchar(200) NOT NULL,
`department` varchar(200) NOT NULL -- department of user
);
COMMENT ON TABLE s2_user_department IS 'user_department_info';
CREATE TABLE IF NOT EXISTS `s2_dictionary_task` (
`id` INT NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL , -- task name
`description` varchar(255) ,
`command`LONGVARCHAR NOT NULL , -- task Request Parameters
`command_md5` varchar(255) NOT NULL , -- task Request Parameters md5
`status` INT NOT NULL , -- the final status of the task
`dimension_ids` varchar(500) NULL ,
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
`created_by` varchar(100) NOT NULL ,
`progress` DOUBLE default 0.00 , -- task real-time progress
`elapsed_ms` bigINT DEFAULT NULL , -- the task takes time in milliseconds
`message` LONGVARCHAR , -- remark related information
PRIMARY KEY (`id`)
);
COMMENT ON TABLE s2_dictionary_task IS 'dictionary task information table';