Skip to content

Commit

Permalink
fix: revise parameter added for unity read/write mode again per addit…
Browse files Browse the repository at this point in the history
…ional PR comments
  • Loading branch information
pmogren committed Feb 14, 2025
1 parent 2c4495e commit 55bdc06
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions daft/unity_catalog/unity_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ def _paginated_list_tables(client: unitycatalog.Unitycatalog, page_token: str |
return self._paginate_to_completion(_paginated_list_tables)

def load_table(

Check warning on line 93 in daft/unity_catalog/unity_catalog.py

View check run for this annotation

Codecov / codecov/patch

daft/unity_catalog/unity_catalog.py#L93

Added line #L93 was not covered by tests
self, table_name: str, new_table_storage_path: str | None = None, mode: Literal["r"|"rw"] = "rw"
self, table_name: str, new_table_storage_path: str | None = None, operation: Literal["READ"|"READ_WRITE"] = "READ_WRITE"
) -> UnityCatalogTable:
"""Loads an existing Unity Catalog table. If the table is not found, and information is provided in the method to create a new table, a new table will be attempted to be registered.
Args:
table_name (str): Name of the table in Unity Catalog in the form of dot-separated, 3-level namespace
new_table_storage_path (str, optional): Cloud storage path URI to register a new external table using this path. Unity Catalog will validate if the path is valid and authorized for the principal, else will raise an exception.
mode (Literal["r", "rw"], optional): The intended use of the table, which impacts authorization. Defaults to "rw".
mode ("READ" or "READ_WRITE", optional): The intended use of the table, which impacts authorization. Defaults to "READ_WRITE".
Returns:
UnityCatalogTable
Expand Down Expand Up @@ -140,7 +140,6 @@ def load_table(
table_id = table_info.table_id
storage_location = table_info.storage_location
# Grab credentials from Unity catalog and place it into the Table
operation = "READ" if mode == "r" else "READ_WRITE"
temp_table_credentials = self._client.temporary_table_credentials.create(operation=operation, table_id=table_id)

Check warning on line 143 in daft/unity_catalog/unity_catalog.py

View check run for this annotation

Codecov / codecov/patch

daft/unity_catalog/unity_catalog.py#L143

Added line #L143 was not covered by tests

scheme = urlparse(storage_location).scheme
Expand Down

0 comments on commit 55bdc06

Please sign in to comment.