Skip to content

chore(wren-ai-service): update query sql api endpoint#1647

Merged
cyyeh merged 3 commits into
mainfrom
chore/ai-service/fix-run-sql
May 13, 2025
Merged

chore(wren-ai-service): update query sql api endpoint#1647
cyyeh merged 3 commits into
mainfrom
chore/ai-service/fix-run-sql

Conversation

@cyyeh

@cyyeh cyyeh commented May 13, 2025

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Updated API endpoint version for data queries, ensuring compatibility with the latest backend changes.
  • Tests
    • Adjusted test mocks to reflect the updated API endpoint version.

@cyyeh cyyeh requested a review from imAsterSun May 13, 2025 07:12
@coderabbitai

coderabbitai Bot commented May 13, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the API endpoint version from "v2" to "v3" for connector query requests across multiple modules and a test file. In one instance, the "limit" key is also removed from the POST payload. No changes are made to function signatures or exported entities.

Changes

File(s) Change Summary
wren-ai-service/eval/data_curation/utils.py
wren-ai-service/eval/utils.py
wren-ai-service/src/providers/engine/wren.py
wren-ai-service/tools/run_sql.py
Updated connector query API endpoint version from /v2/connector/.../query to /v3/connector/.../query. In tools/run_sql.py, also removed the "limit" key from the JSON POST payload.
wren-ai-service/tests/pytest/eval/test_metrics.py Updated mocked POST request URL in test helper from /v2/connector/.../query to /v3/connector/.../query.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant Service
    participant ConnectorAPI

    Caller->>Service: Initiate SQL query (non-duckdb)
    Service->>ConnectorAPI: POST /v3/connector/{data_source}/query
    ConnectorAPI-->>Service: Query result
    Service-->>Caller: Return result
Loading

Suggested reviewers

  • paopa

Poem

A hop to version three, we go,
Where queries now more swiftly flow.
No more v2, the path is clear,
The endpoints changed, the code sincere.
The tests now mock the latest call—
A rabbit’s leap improves us all! 🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@cyyeh cyyeh changed the title chore(wren-ai-service): fix run-sql chore(wren-ai-service): update query api endpoint May 13, 2025
@cyyeh cyyeh changed the title chore(wren-ai-service): update query api endpoint chore(wren-ai-service): update query sql api endpoint May 13, 2025
@cyyeh cyyeh added module/ai-service ai-service related ci/ai-service ai-service related labels May 13, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
wren-ai-service/eval/utils.py (1)

63-66: Verify limit handling and URL construction
The code now appends limit as a query parameter (?limit={limit}) and omits it from the JSON payload. Please confirm that the v3 API expects limit in the URL rather than in the body. For greater robustness and readability, consider using urllib.parse.urlencode or yarl.URL to build URLs instead of manual string concatenation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 853af94 and ff5a428.

📒 Files selected for processing (5)
  • wren-ai-service/eval/data_curation/utils.py (1 hunks)
  • wren-ai-service/eval/utils.py (1 hunks)
  • wren-ai-service/src/providers/engine/wren.py (1 hunks)
  • wren-ai-service/tests/pytest/eval/test_metrics.py (1 hunks)
  • wren-ai-service/tools/run_sql.py (1 hunks)
🔇 Additional comments (5)
wren-ai-service/eval/data_curation/utils.py (1)

69-69: API endpoint version updated successfully

The update from v2 to v3 in the connector query endpoint aligns with the PR objective to fix run-sql functionality.

wren-ai-service/src/providers/engine/wren.py (1)

118-118: API endpoint version updated correctly

The endpoint version for connector queries has been properly updated from v2 to v3, consistent with the changes in other files.

wren-ai-service/tests/pytest/eval/test_metrics.py (1)

70-70: Test mock endpoint correctly updated

The test mock has been properly updated to use the v3 endpoint, maintaining consistency with the implementation code changes.

wren-ai-service/tools/run_sql.py (1)

83-89: API endpoint version updated properly

The connector query endpoint has been correctly updated from v2 to v3. Additionally, the "limit" parameter is now included in the URL query string instead of the JSON payload, which is consistent with the PR's objective.

wren-ai-service/eval/utils.py (1)

63-63: Version bump for connector query endpoint
The connector query path has been updated from /v2/connector/{data_source}/query to /v3/connector/{data_source}/query, aligning with the rest of the codebase.

@imAsterSun imAsterSun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

approved, thanks

@cyyeh cyyeh merged commit a3ce8e3 into main May 13, 2025
12 checks passed
@cyyeh cyyeh deleted the chore/ai-service/fix-run-sql branch May 13, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/ai-service ai-service related module/ai-service ai-service related wren-ai-service

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants