2828from apps .datasource .crud .datasource import get_table_schema
2929from apps .datasource .crud .permission import get_row_permission_filters , is_normal_user
3030from apps .datasource .models .datasource import CoreDatasource
31- from apps .db .db import exec_sql
31+ from apps .db .db import exec_sql , get_version
3232from apps .system .crud .assistant import AssistantOutDs , AssistantOutDsFactory , get_assistant_ds
3333from apps .system .schemas .system_schema import AssistantOutDsSchema
3434from common .core .config import settings
@@ -91,13 +91,13 @@ def __init__(self, current_user: CurrentUser, chat_question: ChatQuestion,
9191 ds = self .out_ds_instance .get_ds (chat .datasource )
9292 if not ds :
9393 raise SingleMessageError ("No available datasource configuration found" )
94- chat_question .engine = ds .type
94+ chat_question .engine = ds .type + get_version ( ds )
9595 chat_question .db_schema = self .out_ds_instance .get_db_schema (ds .id )
9696 else :
9797 ds = self .session .get (CoreDatasource , chat .datasource )
9898 if not ds :
9999 raise SingleMessageError ("No available datasource configuration found" )
100- chat_question .engine = ds .type_name if ds .type != 'excel' else 'PostgreSQL'
100+ chat_question .engine = ( ds .type_name if ds .type != 'excel' else 'PostgreSQL' ) + get_version ( ds )
101101 chat_question .db_schema = get_table_schema (session = self .session , current_user = current_user , ds = ds )
102102
103103 self .generate_sql_logs = list_generate_sql_logs (session = self .session , chart_id = chat_id )
@@ -451,7 +451,7 @@ def select_datasource(self):
451451 if self .current_assistant and self .current_assistant .type in dynamic_ds_types :
452452 _ds = self .out_ds_instance .get_ds (data ['id' ])
453453 self .ds = _ds
454- self .chat_question .engine = _ds .type
454+ self .chat_question .engine = _ds .type + get_version ( self . ds )
455455 self .chat_question .db_schema = self .out_ds_instance .get_db_schema (self .ds .id )
456456 _engine_type = self .chat_question .engine
457457 _chat .engine_type = _ds .type
@@ -461,7 +461,8 @@ def select_datasource(self):
461461 _datasource = None
462462 raise SingleMessageError (f"Datasource configuration with id { _datasource } not found" )
463463 self .ds = CoreDatasource (** _ds .model_dump ())
464- self .chat_question .engine = _ds .type_name if _ds .type != 'excel' else 'PostgreSQL'
464+ self .chat_question .engine = (_ds .type_name if _ds .type != 'excel' else 'PostgreSQL' ) + get_version (
465+ self .ds )
465466 self .chat_question .db_schema = get_table_schema (session = self .session ,
466467 current_user = self .current_user , ds = self .ds )
467468 _engine_type = self .chat_question .engine
0 commit comments