Skip to content

Commit

Permalink
Set default current_datetime in filesystem factory
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed Apr 3, 2024
1 parent be5ca1d commit 33671b4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dlt/destinations/impl/filesystem/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import typing as t

import pendulum

from dlt.destinations.impl.filesystem.configuration import FilesystemDestinationClientConfiguration
from dlt.destinations.impl.filesystem import capabilities
from dlt.common.destination import Destination, DestinationCapabilitiesContext
Expand Down Expand Up @@ -55,3 +57,14 @@ def __init__(
environment=environment,
**kwargs,
)

def configuration(
self, initial_config: FilesystemDestinationClientConfiguration
) -> FilesystemDestinationClientConfiguration:
# If current_datetime is not provided then
# we need to make sure we have it one per
# filesystem destination instance
if not initial_config.current_datetime:
initial_config.current_datetime = pendulum.now()

return super().configuration(initial_config)

0 comments on commit 33671b4

Please sign in to comment.