Skip to content

feat: 将和查询相关的接口迁移至 rest api, 方便AI 和 cli 调用#3191

Open
LeoQuote wants to merge 15 commits into
hhyo:masterfrom
LeoQuote:002-migrate-sqlquery-drf
Open

feat: 将和查询相关的接口迁移至 rest api, 方便AI 和 cli 调用#3191
LeoQuote wants to merge 15 commits into
hhyo:masterfrom
LeoQuote:002-migrate-sqlquery-drf

Conversation

@LeoQuote
Copy link
Copy Markdown
Collaborator

@LeoQuote LeoQuote commented May 29, 2026

将以下和查询相关的接口迁移至 sql_api:

  1. query 执行 SQL 语句
  2. favorate 获取收藏语句
  3. log 获取历史查询
  4. instance_resource 获取实例的库, 表列表
  5. user_all instance 获取用户可查询的实例列表
  6. describe_table 获取表结构

设置中, 默认 permission class 改为管理员拥有 API 权限, 同时开放所有 query 相关接口至所有正常用户, 原先的表, 数据库等级的检查保持不变

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 86.85446% with 84 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.98%. Comparing base (9d50777) to head (463fa93).

Files with missing lines Patch % Lines
sql/services/sqlquery_service.py 63.55% 39 Missing ⚠️
sql/services/resource_service.py 85.91% 10 Missing ⚠️
sql_api/sqlquery_response.py 0.00% 7 Missing ⚠️
sql_api/permissions.py 50.00% 6 Missing ⚠️
sql/services/querylog_service.py 82.14% 5 Missing ⚠️
sql/query.py 33.33% 4 Missing ⚠️
sql/tests.py 82.60% 4 Missing ⚠️
sql_api/api_sqlquery.py 94.44% 4 Missing ⚠️
sql_api/serializers.py 93.75% 3 Missing ⚠️
sql/instance.py 50.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3191      +/-   ##
==========================================
+ Coverage   84.66%   84.98%   +0.32%     
==========================================
  Files         141      149       +8     
  Lines       25015    25433     +418     
==========================================
+ Hits        21179    21615     +436     
+ Misses       3836     3818      -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.

@LeoQuote LeoQuote force-pushed the 002-migrate-sqlquery-drf branch 5 times, most recently from 7afb569 to 44d1d83 Compare June 3, 2026 09:41
LeoQuote added 15 commits June 5, 2026 14:59
- Introduced a unified SQLQuery interface with DRF, enhancing security and authorization.
- Implemented core functionalities including executing queries, managing query logs, and handling favorites.
- Created services for resource management and query execution, ensuring compatibility with existing logic.
- Developed comprehensive tests to validate the new API endpoints and maintain legacy compatibility.
- Established a clear task structure for phased implementation, prioritizing user stories based on criticality.
@LeoQuote LeoQuote force-pushed the 002-migrate-sqlquery-drf branch from 44d1d83 to 463fa93 Compare June 5, 2026 06:59
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.

1 participant