codeant-ai-for-open-source[bot] commented on code in PR #43499:
URL: https://github.com/apache/superset/pull/43499#discussion_r3849601979
##########
superset/models/sql_lab.py:
##########
@@ -551,6 +551,15 @@ def to_dict(self) -> dict[str, Any]:
"id": self.id,
}
+ @property
+ def name(self) -> str:
+ """
+ Expose ``label`` as ``name`` so callers that treat a ``SavedQuery`` as
+ a generic datasource (e.g. chart create/update commands) can rely on
+ a uniform ``name`` attribute across all datasource types.
+ """
+ return self.label
Review Comment:
**Suggestion:** The `label` column is nullable, so a persisted `SavedQuery`
can have `self.label is None` even though this property declares and callers
expect a `str`. Chart creation or updates will then store `None` in
`datasource_name`, breaking the uniform datasource-name contract and producing
charts with a missing datasource name. Either make `label` non-null or provide
an explicit non-null fallback and align the return annotation. [api mismatch]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ⚠️ Chart datasource metadata can be stored without a name.
- ⚠️ Saved-query chart create and update lose datasource identification.
- ⚠️ Generic datasource consumers receive a value violating `name: str`.
```
</details>
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f1b276084cc9438da241861e07fe6c6b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f1b276084cc9438da241861e07fe6c6b&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/models/sql_lab.py
**Line:** 561:561
**Comment:**
*Api Mismatch: The `label` column is nullable, so a persisted
`SavedQuery` can have `self.label is None` even though this property declares
and callers expect a `str`. Chart creation or updates will then store `None` in
`datasource_name`, breaking the uniform datasource-name contract and producing
charts with a missing datasource name. Either make `label` non-null or provide
an explicit non-null fallback and align the return annotation.
Validate the correctness of the flagged issue. If correct, How can I resolve
this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask
user if the user wants to fix the rest of the comments as well. if said yes,
then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43499&comment_hash=206cfcb35caae87655b0f40215391e25352611bfe60b0cfc01fb83f9923e0e8f&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F43499&comment_hash=206cfcb35caae87655b0f40215391e25352611bfe60b0cfc01fb83f9923e0e8f&reaction=dislike'>👎</a>
--
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]