Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_delta_tables helper function #1664

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add arg to make remote table dirs
jorritsandbrink committed Aug 7, 2024
commit 2c29117c02eb2891e5e253124e2dfccf371abf25
11 changes: 7 additions & 4 deletions dlt/destinations/impl/filesystem/filesystem.py
Original file line number Diff line number Diff line change
@@ -303,10 +303,13 @@ def update_stored_schema(

return expected_update

def get_table_dir(self, table_name: str) -> str:
def get_table_dir(self, table_name: str, remote: bool = False) -> str:
# dlt tables do not respect layout (for now)
table_prefix = self.get_table_prefix(table_name)
return self.pathlib.dirname(table_prefix) # type: ignore[no-any-return]
table_dir: str = self.pathlib.dirname(table_prefix)
if remote:
table_dir = self.make_remote_uri(table_dir)
return table_dir

def get_table_prefix(self, table_name: str) -> str:
# dlt tables do not respect layout (for now)
@@ -322,9 +325,9 @@ def get_table_prefix(self, table_name: str) -> str:
self.dataset_path, path_utils.normalize_path_sep(self.pathlib, table_prefix)
)

def get_table_dirs(self, table_names: Iterable[str]) -> List[str]:
def get_table_dirs(self, table_names: Iterable[str], remote: bool = False) -> List[str]:
"""Gets directories where table data is stored."""
return [self.get_table_dir(t) for t in table_names]
return [self.get_table_dir(t, remote=remote) for t in table_names]

def list_table_files(self, table_name: str) -> List[str]:
"""gets list of files associated with one table"""