Skip to content

Commit

Permalink
Add more layout test samples
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed Apr 3, 2024
1 parent 17829b4 commit cc6627c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
25 changes: 13 additions & 12 deletions dlt/destinations/impl/filesystem/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/load/filesystem/test_filesystem_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
"",
)


Expand Down

0 comments on commit cc6627c

Please sign in to comment.