Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit bd5e52f

Browse files
authored
fix(s3_delta): add default filter
1 parent aa17d71 commit bd5e52f

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

odd_collector_aws/adapters/s3_delta/client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def __init__(self, config: S3DeltaPlugin) -> None:
6161
self.storage_options: StorageOptions = StorageOptions.from_config(config)
6262
self.fs = FileSystem(config)
6363

64-
def load_delta_table(self, delta_table_config: DeltaTableConfig) -> None:
64+
def load_delta_table(self, delta_table_config: DeltaTableConfig) -> DeltaTable:
6565
try:
6666
return DeltaTable(
6767
delta_table_config.path,
@@ -74,14 +74,15 @@ def handle_folder(self, config: DeltaTableConfig) -> Iterable[DTable]:
7474
logger.debug(f"Getting delta tables from folder {config.path}")
7575

7676
objects = self.fs.get_file_info(remove_protocol(config.path))
77+
7778
allowed = filter(
78-
lambda object: not object.is_file and config.allow(object.base_name),
79+
lambda obj: not obj.is_file and config.allow(obj.base_name),
7980
objects,
8081
)
8182

82-
for object in allowed:
83-
config = config.append_prefix(object.base_name)
84-
yield from self.get_table(config)
83+
for obj in allowed:
84+
new_config = config.append_prefix(obj.base_name)
85+
yield from self.get_table(new_config)
8586

8687
def get_table(self, delta_table_config: DeltaTableConfig) -> Iterable[DTable]:
8788
# sourcery skip: raise-specific-error

odd_collector_aws/domain/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, List, Literal, Optional
1+
from typing import List, Literal, Optional
22

33
from odd_collector_sdk.domain.filter import Filter
44
from odd_collector_sdk.domain.plugin import Plugin
@@ -42,7 +42,7 @@ class DeltaTableConfig(BaseModel):
4242
scheme: str = Field(default="s3", alias="schema")
4343
bucket: str
4444
prefix: str
45-
object_filter: Optional[Filter] = None
45+
object_filter: Optional[Filter] = Filter()
4646

4747
@property
4848
def path(self) -> str:

0 commit comments

Comments
 (0)