Skip to content

Commit

Permalink
Adjust suffix param type
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed Mar 27, 2024
1 parent ba320dd commit ad68db6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dlt/destinations/impl/filesystem/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FilesystemDestinationClientConfiguration(
current_datetime: Optional[Union[DateTime, TCurrentDatetimeCallback]] = None
datetime_format: Optional[TDatetimeFormat] = None
layout_params: Optional[Dict[str, Union[str, TLayoutParamCallback]]] = None
suffix: Optional[Callable[[PathParams], str]] = None
suffix: Optional[Union[str, Callable[[PathParams], str]]] = None

@resolve_type("credentials")
def resolve_credentials_type(self) -> Type[CredentialsConfiguration]:
Expand Down
4 changes: 4 additions & 0 deletions dlt/destinations/impl/filesystem/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from dlt.destinations.impl.filesystem import capabilities
from dlt.common.destination import Destination, DestinationCapabilitiesContext
from dlt.common.storages.configuration import FileSystemCredentials
from dlt.destinations.path_utils import PathParams

if t.TYPE_CHECKING:
from dlt.destinations.impl.filesystem.filesystem import FilesystemClient
Expand All @@ -31,6 +32,7 @@ def __init__(
current_datetime: t.Optional[datetime] = None,
datetime_format: t.Optional[str] = None,
layout_params: t.Optional[t.Dict[str, t.Any]] = None,
suffix_fn: t.Optional[t.Callable[[PathParams], str]] = None,
**kwargs: t.Any,
) -> None:
"""Configure the filesystem destination to use in a pipeline and load data to local or remote filesystem.
Expand All @@ -54,6 +56,7 @@ def __init__(
datetime_format: strftime formatting for current_datetime
layout_params: custom layout parameters, all unknown parameters will be skipped,
values can be primitive types or callables which also should return a primitive type.
suffix_fn: a callback if specified will be called to generate a suffix string to final path
**kwargs: Additional arguments passed to the destination config
"""
# TODO: validate parameters
Expand All @@ -64,6 +67,7 @@ def __init__(
current_datetime=current_datetime,
datetime_format=datetime_format,
layout_params=layout_params,
suffix_fn=suffix_fn,
environment=environment,
**kwargs,
)

0 comments on commit ad68db6

Please sign in to comment.