Skip to content

Commit

Permalink
Add current_datetime, datetime_format and layout_params to filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed Mar 26, 2024
1 parent 9566199 commit 8ce90d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions dlt/destinations/impl/filesystem/factory.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import datetime
import typing as t

from dlt.destinations.impl.filesystem.configuration import FilesystemDestinationClientConfiguration
Expand Down Expand Up @@ -27,6 +28,9 @@ def __init__(
credentials: t.Union[FileSystemCredentials, t.Dict[str, t.Any], t.Any] = None,
destination_name: t.Optional[str] = None,
environment: t.Optional[str] = None,
current_datetime: t.Optional[datetime] = None,
datetime_format: t.Optional[str] = None,
layout_params: t.Optional[t.Dict[str, t.Any]] = None,
**kwargs: t.Any,
) -> None:
"""Configure the filesystem destination to use in a pipeline and load data to local or remote filesystem.
Expand All @@ -46,12 +50,19 @@ def __init__(
credentials: Credentials to connect to the filesystem. The type of credentials should correspond to
the bucket protocol. For example, for AWS S3, the credentials should be an instance of `AwsCredentials`.
A dictionary with the credentials parameters can also be provided.
current_datetime: current datetime used instead of datetime generated by dlt.
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.
**kwargs: Additional arguments passed to the destination config
"""
super().__init__(
bucket_url=bucket_url,
credentials=credentials,
destination_name=destination_name,
current_datetime=current_datetime,
datetime_format=datetime_format,
layout_params=layout_params,
environment=environment,
**kwargs,
)
2 changes: 1 addition & 1 deletion dlt/destinations/path_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# this can probably go some other place, but it is shared by destinations, so for now it is here
from typing import List, Sequence, Tuple
from typing import List, Sequence

import pendulum
import re
Expand Down

0 comments on commit 8ce90d6

Please sign in to comment.