korbit-ai[bot] commented on code in PR #32556:
URL: https://github.com/apache/superset/pull/32556#discussion_r1986526626
##########
superset/daos/database.py:
##########
@@ -166,6 +170,37 @@ def get_ssh_tunnel(cls, database_id: int) -> SSHTunnel |
None:
return ssh_tunnel
+ @classmethod
+ def is_odps_partitioned_table(
+ cls, database: Database, table_name: str
+ ) -> Tuple[bool, List[str]]:
+ """
+ This function is used to determine and retrieve
+ partition information of the odsp table.
+ The return values are whether the partition
+ table is partitioned and the names of all partition fields.
+ """
+ if not database:
+ raise ValueError("Database not found")
+ uri = database.sqlalchemy_uri
+ access_key = database.password
+ pattern = re.compile(
+
r"odps://(?P<username>[^:]+):(?P<password>[^@]+)@(?P<project>[^/]+)/(?:\?endpoint=(?P<endpoint>[^&]+))"
+ )
+ if match := pattern.match(unquote(uri)):
Review Comment:
Thank you for your work, @zhutong6688. Your explanation makes sense, as the
URI extraction is specific to the ODPS. However, it might be beneficial in the
future if we consider making the regular expression slightly more flexible to
handle different URI formats or additional parameters. This is not a
showstopper for this PR, though, so just keep it in mind for future iterations.
We appreciate your contribution!
--
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]