From 33671b4a06646bf1ae26e6950dcae6c7625dcacb Mon Sep 17 00:00:00 2001 From: Sultan Iman Date: Wed, 3 Apr 2024 14:10:51 +0200 Subject: [PATCH] Set default current_datetime in filesystem factory --- dlt/destinations/impl/filesystem/factory.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dlt/destinations/impl/filesystem/factory.py b/dlt/destinations/impl/filesystem/factory.py index 029a5bdda5..3e88fea814 100644 --- a/dlt/destinations/impl/filesystem/factory.py +++ b/dlt/destinations/impl/filesystem/factory.py @@ -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 @@ -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)