|
75 | 75 | ) |
76 | 76 | from pyiceberg.io import ( |
77 | 77 | ADLS_SAS_TOKEN, |
| 78 | + ADLS_TOKEN, |
78 | 79 | AWS_ACCESS_KEY_ID, |
79 | 80 | AWS_PROFILE_NAME, |
80 | 81 | AWS_REGION, |
@@ -368,7 +369,7 @@ def _uuid7() -> uuid.UUID: |
368 | 369 | def _is_short_lived_credential(key: str) -> bool: |
369 | 370 | """Whether a loadTable config key carries a short-lived storage credential.""" |
370 | 371 | key = key.lower() |
371 | | - return key in (S3_SESSION_TOKEN, GCS_TOKEN) or key.startswith(ADLS_SAS_TOKEN) |
| 372 | + return key in (S3_SESSION_TOKEN, AWS_SESSION_TOKEN, GCS_TOKEN, ADLS_TOKEN, TOKEN) or key.startswith(ADLS_SAS_TOKEN) |
372 | 373 |
|
373 | 374 |
|
374 | 375 | def _retry_hook(retry_state: RetryCallState) -> None: |
@@ -618,6 +619,19 @@ def __init__(self, name: str, **properties: str): |
618 | 619 | self._table_cache = TTLCache(maxsize=max_entries, ttl=ttl_ms / 1000) if max_entries > 0 else None |
619 | 620 | self._table_cache_lock = threading.Lock() |
620 | 621 |
|
| 622 | + def __getstate__(self) -> dict[str, Any]: |
| 623 | + """Create a dictionary of the RestCatalog fields used when pickling, with an empty table cache.""" |
| 624 | + state = self.__dict__.copy() |
| 625 | + if (cache := state["_table_cache"]) is not None: |
| 626 | + state["_table_cache"] = TTLCache(maxsize=cache.maxsize, ttl=cache.ttl) |
| 627 | + del state["_table_cache_lock"] |
| 628 | + return state |
| 629 | + |
| 630 | + def __setstate__(self, state: dict[str, Any]) -> None: |
| 631 | + """Deserialize the state into a RestCatalog instance.""" |
| 632 | + self.__dict__ = state |
| 633 | + self._table_cache_lock = threading.Lock() |
| 634 | + |
621 | 635 | def _invalidate_cached_table(self, identifier: str | Identifier) -> None: |
622 | 636 | if self._table_cache is not None: |
623 | 637 | with self._table_cache_lock: |
|
0 commit comments