fix(odps): address review feedback - security, recursion, typing, tests

- Move security check before ODPS partition detection (auth before backend calls)
- Wrap is_odps_partitioned_table in try/except with warning log and fallback
- Replace OdpsBaseEngineSpec.get_table_metadata body with NotImplementedError
- Fix select_star signature: engine: Engine -> dialect: Dialect (matches base)
- Update Optional[X] -> X | None for modern Python typing
- Remove broken __eq__ that violated frozen dataclass hash contract
- Fix Partition docstring typos and __str__ description
- Add warning log when ODPS URI does not match expected pattern
- Add tests/unit_tests/db_engine_specs/test_odps.py with 7 unit tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Code
2026-03-11 14:00:48 -07:00
parent 23b8d323a3
commit 925e20bb04
5 changed files with 214 additions and 19 deletions

View File

@@ -326,10 +326,10 @@ class Table:
class Partition:
"""
Partition object, with two attribute keys:
ispartitioned_table and partition_comlumn,
is_partitioned_table and partition_column,
used to provide partition information
Here is an example of an object:
{"ispartitioned_table":true,"partition_column":["month","day"]}
{"is_partitioned_table": true, "partition_column": ["month", "day"]}
"""
is_partitioned_table: bool
@@ -337,7 +337,7 @@ class Partition:
def __str__(self) -> str:
"""
Return the partition columns of table name.
Return a string representation of the Partition object.
"""
partition_column_str = (
", ".join(map(str, self.partition_column))
@@ -349,9 +349,6 @@ class Partition:
f"partition_column=[{partition_column_str}])"
)
def __eq__(self, other: Any) -> bool:
return str(self) == str(other)
# To avoid unnecessary parsing/formatting of queries, the statement has the concept of
# an "internal representation", which is the AST of the SQL statement. For most of the