23 lines
725 B
Python
23 lines
725 B
Python
from typing import Any, Optional
|
|
|
|
|
|
class MyIOManager(PolarsParquetIOManager):
|
|
def _load_partition_from_path(
|
|
self,
|
|
context: InputContext,
|
|
partition_key: str,
|
|
path: "UPath",
|
|
backcompat_path: Optional["UPath"] = None,
|
|
) -> Any:
|
|
try:
|
|
return super()._load_partition_from_path(
|
|
context, partition_key, path, backcompat_path
|
|
)
|
|
except FileNotFoundError:
|
|
# Handle the case where the partition file does not exist
|
|
context.log.warning(
|
|
f"Partition file not found for key {partition_key} at path {path}. "
|
|
"Returning an empty DataFrame."
|
|
)
|
|
return None
|