diff --git a/dlt/destinations/impl/filesystem/layout.py b/dlt/destinations/impl/filesystem/layout.py index aa0e0689b9..3a5fb14255 100644 --- a/dlt/destinations/impl/filesystem/layout.py +++ b/dlt/destinations/impl/filesystem/layout.py @@ -105,18 +105,19 @@ def params(self) -> Optional[Dict[str, Any]]: # For each callable extra parameter # otherwise take it's value - for key, value in self.config.extra_params.items(): - if callable(value): - self._params[key] = value( - self.schema_name, - self.table_name, - self.load_id, - self.file_id, - self.file_format, - now, - ) - else: - self._params[key] = value + if self.config.extra_params: + for key, value in self.config.extra_params.items(): + if callable(value): + self._params[key] = value( + self.schema_name, + self.table_name, + self.load_id, + self.file_id, + self.file_format, + now, + ) + else: + self._params[key] = value # For formatting options please see # https://github.com/sdispater/pendulum/blob/master/docs/docs/string_formatting.md diff --git a/tests/load/filesystem/test_filesystem_client.py b/tests/load/filesystem/test_filesystem_client.py index 18149a685f..e4a4daea04 100644 --- a/tests/load/filesystem/test_filesystem_client.py +++ b/tests/load/filesystem/test_filesystem_client.py @@ -34,6 +34,13 @@ def logger_autouse() -> None: "{schema_name}/{table_name}/{load_id}.{file_id}.{ext}", # new default layout with schema "{schema_name}.{table_name}.{load_id}.{file_id}.{ext}", # classic layout "{table_name}88{load_id}-u-{file_id}.{ext}", # default layout with strange separators + # Extra layout options + "{table_name}/{curr_date}/{load_id}.{file_id}.{ext}{timestamp}", + "{table_name}/{year}/{month}/{day}/{load_id}.{file_id}.{ext}", + "{table_name}/{day}/{hour}/{minute}/{load_id}.{file_id}.{ext}", + "{table_name}/{timestamp}/{load_id}.{file_id}.{ext}", + "{table_name}/{dow}/{load_id}.{file_id}.{ext}", + "", )