doris审计日志获取sql,没法直接执行

Viewed 27

由于可能会需要通过quickbi等服务查询doris,通过审计日志查询的时候,获取到的sql直接成为一行了。
(如果中间有注释 -- 的情况)如果把sql直接执行是会报错的

2 Answers

这个方便提供下带注释的audit log sql,这里sql是query还是insert?

下面这个是从审计日志里面搜索到的SQL:

-- SQL From QuickBI, traceId: 8b699142-8bfa-40a8-ba68-18c1dd58f1a8  SELECT AME_T_1_.`item_source` AS T_AF3_2_, SUM(if( AME_T_1_.`item_status`  = 400  -- and  AME_T_1_.`buyer_code` ='CGK-TRAVELOKA' AND  AME_T_1_.`issued_time` >=DATETIME('2023-09-01 00:00:00') AND 'Y' = 'Y' ,  AME_T_1_.`total_profit_cny`  ,  AME_T_1_.`total_profit_cny` - AME_T_1_.`buyer_rebate_amount_cny` )) AS T_A7E_3_ FROM `dm`.`dm_air_order_item` AS AME_T_1_ WHERE AME_T_1_.`create_time` >= STR_TO_DATE('2024-10-24 00:00:00','%Y-%m-%d %H:%i:%s') AND AME_T_1_.`create_time` <= STR_TO_DATE('2024-10-24 23:59:59','%Y-%m-%d %H:%i:%s') AND (AME_T_1_.`item_status` = 300 OR AME_T_1_.`item_status` = 400) AND AME_T_1_.`is_cabin_disparity` = 'Y' AND AME_T_1_.`product_type` NOT IN ('LGS_SYNCHRO') AND AME_T_1_.`enabled_flag` IN ('Y') GROUP BY AME_T_1_.`item_source`  LIMIT 0, 1000