korbit-ai[bot] commented on code in PR #33525:
URL: https://github.com/apache/superset/pull/33525#discussion_r2096587751
##########
superset/sql/parse.py:
##########
@@ -437,6 +448,16 @@ def as_cte(self, alias: str = "__cte") -> SQLStatement:
"""
raise NotImplementedError()
+ def as_create_table(self, table: Table, method: CTASMethod) ->
SQLStatement:
+ """
+ Rewrite the statement as a `CREATE TABLE AS` statement.
+
+ :param table: The table to create.
+ :param method: The method to use for creating the table.
+ :return: A new SQLStatement with the CTE.
+ """
Review Comment:
### Incorrect return value documentation <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
The docstring return value incorrectly states it returns a CTE instead of a
CREATE TABLE statement
###### Why this matters
Having incorrect return value documentation can mislead developers about the
method's behavior
###### Suggested change ∙ *Feature Preview*
def as_create_table(self, table: Table, method: CTASMethod) -> SQLStatement:
"""
Rewrite the statement as a `CREATE TABLE AS` statement.
:param table: The table to create.
:param method: The method to use for creating the table.
:return: A new SQLStatement with the CREATE TABLE AS statement.
"""
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/db93aa3f-3698-4b71-a011-de5361221f89/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/db93aa3f-3698-4b71-a011-de5361221f89?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/db93aa3f-3698-4b71-a011-de5361221f89?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/db93aa3f-3698-4b71-a011-de5361221f89?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/db93aa3f-3698-4b71-a011-de5361221f89)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:0043aec3-8ff5-48af-bfd8-b472f9bef094 -->
[](0043aec3-8ff5-48af-bfd8-b472f9bef094)
##########
superset/sql/parse.py:
##########
@@ -108,6 +108,11 @@
FETCH_MANY = enum.auto()
+class CTASMethod(enum.Enum):
+ TABLE = enum.auto()
+ VIEW = enum.auto()
Review Comment:
### Undocumented enum options <sub></sub>
<details>
<summary>Tell me more</summary>
###### What is the issue?
Missing docstring explaining the enum values and their purpose
###### Why this matters
Without documentation, developers won't understand the semantic difference
between TABLE and VIEW options
###### Suggested change ∙ *Feature Preview*
class CTASMethod(enum.Enum):
"""
Methods for creating tables/views from SELECT statements.
TABLE: Creates a new table
VIEW: Creates a new view
"""
TABLE = enum.auto()
VIEW = enum.auto()
###### Provide feedback to improve future suggestions
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ec1aefe2-397c-4f48-b8c1-7c57c0f456df/upvote)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ec1aefe2-397c-4f48-b8c1-7c57c0f456df?what_not_true=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ec1aefe2-397c-4f48-b8c1-7c57c0f456df?what_out_of_scope=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ec1aefe2-397c-4f48-b8c1-7c57c0f456df?what_not_in_standard=true)
[](https://app.korbit.ai/feedback/aa91ff46-6083-4491-9416-b83dd1994b51/ec1aefe2-397c-4f48-b8c1-7c57c0f456df)
</details>
<sub>
💬 Looking for more details? Reply to this comment to chat with Korbit.
</sub>
<!--- korbi internal id:a6a406ae-5c09-4d8e-82fd-e6d936267ccd -->
[](a6a406ae-5c09-4d8e-82fd-e6d936267ccd)
--
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]