bito-code-review[bot] commented on code in PR #38414:
URL: https://github.com/apache/superset/pull/38414#discussion_r2895040385
##########
superset/mcp_service/sql_lab/schemas.py:
##########
@@ -115,6 +115,64 @@ class ExecuteSqlResponse(BaseModel):
)
+class SaveSqlQueryRequest(BaseModel):
+ """Request schema for saving a SQL query."""
+
+ database_id: int = Field(
+ ..., description="Database connection ID the query runs against"
+ )
+ label: str = Field(
+ ...,
+ description="Name for the saved query (shown in Saved Queries list)",
+ min_length=1,
+ max_length=256,
+ )
+ sql: str = Field(
+ ...,
+ description="SQL query text to save",
+ )
+ schema_name: str | None = Field(
+ None,
+ description="Schema the query targets",
+ alias="schema",
+ )
+ catalog: str | None = Field(None, description="Catalog name (if
applicable)")
+ description: str | None = Field(
+ None, description="Optional description of the query"
+ )
+
+ @field_validator("sql")
+ @classmethod
+ def sql_not_empty(cls, v: str) -> str:
+ if not v or not v.strip():
+ raise ValueError("SQL query cannot be empty")
+ return v.strip()
+
+ @field_validator("label")
+ @classmethod
+ def label_not_empty(cls, v: str) -> str:
+ if not v or not v.strip():
+ raise ValueError("Label cannot be empty")
+ return v.strip()
+
+
+class SaveSqlQueryResponse(BaseModel):
+ """Response schema for a saved SQL query."""
+
+ id: int = Field(..., description="Saved query ID")
+ label: str = Field(..., description="Query name")
+ sql: str = Field(..., description="SQL query text")
+ database_id: int = Field(..., description="Database ID")
+ schema_name: str | None = Field(None, description="Schema name",
alias="schema")
+ description: str | None = Field(None, description="Query description")
Review Comment:
<!-- Bito Reply -->
This question isn’t related to the pull request. I can only help with
questions about the PR’s code or comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]