Skip to content

Fixed Native Query API Response#12407

Merged
ZoranPandovski merged 5 commits into
releases/26.2.0from
bugfix/native_query_response
Apr 27, 2026
Merged

Fixed Native Query API Response#12407
ZoranPandovski merged 5 commits into
releases/26.2.0from
bugfix/native_query_response

Conversation

@MinuraPunchihewa
Copy link
Copy Markdown
Contributor

@MinuraPunchihewa MinuraPunchihewa commented Apr 23, 2026

Description

This PR fixes the API response for native queries. The fact that this API errors out is causing the Minds API for querying data sources, which Anton relies on, to fail as well.

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)

Verification Process

To ensure the changes are working as expected:

  • Test Location: Specify the URL or path for testing.
  • Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Checklist:

  • My code follows the style guidelines(PEP 8) of MindsDB.
  • I have appropriately commented on my code, especially in complex areas.
  • Necessary documentation updates are either made or tracked in issues - N/A
  • Relevant unit and integration tests are updated or added.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown
Contributor

EntelligenceAI PR Summary

Refactors the post method in mindsdb/api/http/namespaces/sql.py to unify native and non-native query handling paths.

  • Replaces raw query_response dicts with SQLAnswer objects in the native query branch for consistency
  • Renames result to raw_result to prevent variable shadowing
  • Introduces error_type distinction ('expected' vs 'unexpected') for error classification
  • De-indents context retrieval and response formatting logic so it is shared across both the native-handler and process_query code paths

Confidence Score: 5/5 - Safe to Merge

Safe to merge — this PR cleanly refactors the post method in mindsdb/api/http/namespaces/sql.py by unifying the native and non-native query handling paths, which reduces code duplication and improves maintainability. The introduction of SQLAnswer objects in the native query branch for consistency, renaming result to raw_result to prevent variable shadowing, and the error_type distinction between 'expected' and 'unexpected' errors are all well-scoped improvements with no identified logic regressions. No review comments were generated and heuristic analysis found zero critical, significant, or medium issues across the changed file.

Key Findings:

  • The rename from result to raw_result in sql.py correctly eliminates a variable shadowing risk that could have caused subtle bugs when the outer result variable was referenced later in the shared code path.
  • Replacing raw query_response dicts with SQLAnswer objects in the native query branch enforces a consistent contract for downstream response formatting, reducing the risk of missing fields or type mismatches.
  • De-indenting the context retrieval and response formatting logic so it is shared across both native-handler and standard paths is a net reduction in duplicated code, lowering the surface area for future divergence bugs.
  • Automated heuristic analysis found zero issues at any severity level across the single changed file, and no pre-existing unresolved comments were identified.
Files requiring special attention
  • mindsdb/api/http/namespaces/sql.py

Comment thread mindsdb/__about__.py Outdated
__title__ = "MindsDB"
__package_name__ = "mindsdb"
__version__ = "26.1.0"
__version__ = "26.1.1"
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.

I think it should be in a release pr

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just updated it to point to the release branch.

@MinuraPunchihewa MinuraPunchihewa changed the base branch from main to releases/26.2.0 April 24, 2026 18:39
@ZoranPandovski ZoranPandovski merged commit 41edda7 into releases/26.2.0 Apr 27, 2026
19 checks passed
@ZoranPandovski ZoranPandovski deleted the bugfix/native_query_response branch April 27, 2026 05:54
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants