Skip to content

feat(workflow):增加SQL上线工单的批量操作(如批量提交、审核、执行、终止) - #3204

Open
RankRao wants to merge 4 commits into
hhyo:masterfrom
RankRao:feat-batch-workflow
Open

feat(workflow):增加SQL上线工单的批量操作(如批量提交、审核、执行、终止)#3204
RankRao wants to merge 4 commits into
hhyo:masterfrom
RankRao:feat-batch-workflow

Conversation

@RankRao

@RankRao RankRao commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

【批量操作】:在SQL上线模块,增加批量操作功能。

在提交SQL的页面(/submitsql/)更改内容:
1、多实例单库的场景:将当前的【请选择实例:】由单选改为多选,对应后端也改,最终可以生成多实例单库的多个工单。SQL检测,只检测第一个实例的SQL,其他实例不重复检测。
2、单实例多库的场景:将当前的【请选择数据库:】由单选改为多选,对应后端也改,最终可以生成单实例多库的多个工单。SQL检测,只检测第一个库的SQL,其他库不重复检测。
3、多实例多库的场景:生成的工单数就变成M*N了。SQL检测,只检测第一个实例,第一个库的SQL,不重复检测。

在工单流的查看页面(/sqlworkflow/)更改内容:
1、在每个工单名称前增加一列,勾选框,可多选多个工单。
2、在现有的【提交SQL】按钮右侧,增加选择操作,采用dropdown的形式折叠起来:批量审核SQL、批量执行SQL、批量终止工单。
批量功能,按照工单的提交顺序,先提交的先操作,后提交的后操作。注:这个批量顺序,只是触发顺序,最终的结束时间顺序是按照实例本身的执行情况,有可能后操作的,反而先执行成功。
要求:批量勾选的所有工单处于同一个状态,验证每个工单当前用户都有可操作权限(审核、执行、终止)。

和这个discussions#1578不同的地方是:
1、没有【提交批量SQL】按钮,而是通过多选实例和库的方式实现。
2、没有【提交批量回滚工单】按钮,回滚逻辑本来就有点复杂,而且当前也只支持mysql库的回滚。
相关回滚可以自行通过单个工单的回滚SQL提交,然后多选实例和库来批量提交。

Comment thread sql_api/api_workflow.py Fixed
Comment thread sql_api/api_workflow.py Fixed
Comment thread sql_api/serializers.py Fixed
Comment thread sql_api/serializers.py Fixed
Comment thread sql_api/serializers.py Fixed
Comment thread sql_api/serializers.py Fixed
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.07317% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.07%. Comparing base (459c680) to head (d826d30).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
sql_api/api_workflow.py 82.60% 20 Missing ⚠️
sql_api/serializers.py 89.38% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3204      +/-   ##
==========================================
+ Coverage   87.82%   88.07%   +0.24%     
==========================================
  Files         157      157              
  Lines       28486    28930     +444     
==========================================
+ Hits        25018    25480     +462     
+ Misses       3468     3450      -18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5b7ff7121

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sql_api/api_workflow.py
Comment thread sql/templates/sqlworkflow.html Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb4e59d8ac

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sql_api/serializers.py
Comment thread sql_api/serializers.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ee7d32da4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sql_api/serializers.py
Comment thread sql_api/api_workflow.py
Comment thread sql_api/serializers.py
Comment thread sql_api/serializers.py

@LeoQuote LeoQuote left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个实现方式上, 是否考虑利用现有接口, 通过前端的更改来进行实现? 前端可以逐个发送请求, 在异常时直接中止, 这样来实现可能会更加简单方便.

当前的实现方式我的修改意见如下

Comment thread sql/utils/workflow_audit.py
Comment thread sql_api/api_workflow.py Outdated
@RankRao

RankRao commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

这个实现方式上, 是否考虑利用现有接口, 通过前端的更改来进行实现? 前端可以逐个发送请求, 在异常时直接中止, 这样来实现可能会更加简单方便.

当前的实现方式我的修改意见如下

纯前端的实现在性能上可能有问题吧,

批量提交的场景,我认为是在多实例或者多库的分库分表场景下,一般20-30个不算多吧,前端一下子这么多请求,有点怪。
当前为了节约性能,在后端分批提交,是做了一个只检测第一个功能,其他复用检测结果,
后续通过审核或执行来真实检测工单,让【批量提交】这一步真的能快速提交,不卡顿。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f68ef8cdb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sql_api/serializers.py
@RankRao
RankRao requested a review from LeoQuote June 18, 2026 04:32
@RankRao
RankRao force-pushed the feat-batch-workflow branch from 8f68ef8 to a41a09d Compare June 18, 2026 10:00
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@RankRao
RankRao force-pushed the feat-batch-workflow branch 2 times, most recently from f054451 to 87eb9d7 Compare July 27, 2026 11:46

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87eb9d71f7

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sql_api/api_workflow.py
Comment thread sql_api/api_workflow.py
Comment thread sql_api/serializers.py
Comment thread sql_api/api_workflow.py
1、修复审核可能不填备注的情况。
2、内部错误信息泄露风险优化。
3、修复终止权限的判断。
4、补充单元测试。
通知消息的函数改名。
@RankRao
RankRao force-pushed the feat-batch-workflow branch from 87eb9d7 to d826d30 Compare August 13, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants