diff --git a/dlt/destinations/impl/filesystem/filesystem.py b/dlt/destinations/impl/filesystem/filesystem.py index 37344f8394..c532b24fb8 100644 --- a/dlt/destinations/impl/filesystem/filesystem.py +++ b/dlt/destinations/impl/filesystem/filesystem.py @@ -48,8 +48,6 @@ def __init__( super().__init__(file_name) fs_client, _ = fsspec_from_config(config) self.destination_file_name = make_filename(config, file_name, schema_name, load_id) - - # Once directory is created we can move things item = self.make_remote_path() fs_client.put_file(local_path, item) diff --git a/dlt/destinations/impl/filesystem/layout.py b/dlt/destinations/impl/filesystem/layout.py index 6a0e14fa10..af41e1e6c3 100644 --- a/dlt/destinations/impl/filesystem/layout.py +++ b/dlt/destinations/impl/filesystem/layout.py @@ -76,16 +76,12 @@ def params(self) -> Optional[Dict[str, Any]]: } ) - # If current_datetime is not given - # Then take current moment in time # If current_datetime is callable # Then call it and check it's instance # If the result id DateTime # Then take it # Else exit. - if not self.config.current_datetime: - self.config.current_datetime = pendulum.now() - elif callable(self.config.current_datetime): + if callable(self.config.current_datetime): result = self.config.current_datetime() if isinstance(result, pendulum.DateTime): self.current_datetime = result @@ -108,14 +104,23 @@ def params(self) -> Optional[Dict[str, Any]]: if self.config.extra_placeholders: for key, value in self.config.extra_placeholders.items(): if callable(value): - self._params[key] = value( - self.schema_name, - self.table_name, - self.load_id, - self.file_id, - self.file_format, - now, - ) + try: + self._params[key] = value( + self.schema_name, + self.table_name, + self.load_id, + self.file_id, + self.file_format, + now, + ) + except TypeError: + fmt.secho( + f"Extra placeholder {key} is callableCallable placeholder should accept" + f" parameters below`schema name`, `table name`, `load_id`, `file_id`," + f" `extension` and `current_datetime`", + fg="red", + ) + raise else: self._params[key] = value