cloe-nessy 1.0.5__py3-none-any.whl → 1.0.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloe_nessy/integration/delta_loader/strategies/delta_cdf_loader.py +11 -3
- cloe_nessy/integration/reader/catalog_reader.py +12 -2
- {cloe_nessy-1.0.5.dist-info → cloe_nessy-1.0.6.dist-info}/METADATA +1 -1
- {cloe_nessy-1.0.5.dist-info → cloe_nessy-1.0.6.dist-info}/RECORD +5 -5
- {cloe_nessy-1.0.5.dist-info → cloe_nessy-1.0.6.dist-info}/WHEEL +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import contextlib
|
|
2
|
+
|
|
1
3
|
from pydantic import BaseModel, Field
|
|
2
4
|
from pyspark.sql import DataFrame
|
|
3
5
|
from pyspark.sql import functions as F
|
|
@@ -231,7 +233,9 @@ class DeltaCDFLoader(DeltaLoader):
|
|
|
231
233
|
df = self.table_reader.load(self.table_identifier)
|
|
232
234
|
|
|
233
235
|
# Cache the DataFrame since it will be used for both counting and returning
|
|
234
|
-
|
|
236
|
+
# Note: .cache() is not supported on serverless compute, so we suppress errors
|
|
237
|
+
with contextlib.suppress(Exception):
|
|
238
|
+
df.cache()
|
|
235
239
|
row_count = df.count()
|
|
236
240
|
|
|
237
241
|
self._create_metadata_entry(
|
|
@@ -280,7 +284,9 @@ class DeltaCDFLoader(DeltaLoader):
|
|
|
280
284
|
df = df.filter("_change_type <> 'update_preimage'")
|
|
281
285
|
|
|
282
286
|
# Cache the DataFrame as it will be used multiple times
|
|
283
|
-
|
|
287
|
+
# Note: .cache() is not supported on serverless compute, so we suppress errors
|
|
288
|
+
with contextlib.suppress(Exception):
|
|
289
|
+
df.cache()
|
|
284
290
|
|
|
285
291
|
# Optimize timestamp extraction by combining operations
|
|
286
292
|
start_commit_timestamp = None
|
|
@@ -338,7 +344,9 @@ class DeltaCDFLoader(DeltaLoader):
|
|
|
338
344
|
result_df = df.drop("_commit_version", "_commit_timestamp")
|
|
339
345
|
|
|
340
346
|
# Unpersist the cached DataFrame to free memory
|
|
341
|
-
|
|
347
|
+
# Note: unpersist may fail if cache wasn't successful on serverless
|
|
348
|
+
with contextlib.suppress(Exception):
|
|
349
|
+
df.unpersist()
|
|
342
350
|
|
|
343
351
|
return result_df
|
|
344
352
|
|
|
@@ -71,7 +71,12 @@ class CatalogReader(BaseReader):
|
|
|
71
71
|
df = self._spark.read.table(table_identifier, **options)
|
|
72
72
|
return df
|
|
73
73
|
except AnalysisException as err:
|
|
74
|
-
|
|
74
|
+
# Only convert to "Table not found" if it's actually a table not found error
|
|
75
|
+
error_message = str(err)
|
|
76
|
+
if "not found" in error_message.lower() or "does not exist" in error_message.lower():
|
|
77
|
+
raise ValueError(f"Table not found: {table_identifier}") from err
|
|
78
|
+
# Re-raise other AnalysisException errors with original message
|
|
79
|
+
raise
|
|
75
80
|
except Exception as err:
|
|
76
81
|
raise ReadOperationFailedError(
|
|
77
82
|
f"An error occurred while reading the table '{table_identifier}': {err}"
|
|
@@ -111,7 +116,12 @@ class CatalogReader(BaseReader):
|
|
|
111
116
|
df = self._spark.readStream.table(table_identifier, **options)
|
|
112
117
|
return df
|
|
113
118
|
except AnalysisException as err:
|
|
114
|
-
|
|
119
|
+
# Only convert to "Table not found" if it's actually a table not found error
|
|
120
|
+
error_message = str(err)
|
|
121
|
+
if "not found" in error_message.lower() or "does not exist" in error_message.lower():
|
|
122
|
+
raise ValueError(f"Table not found or not streamable: {table_identifier}") from err
|
|
123
|
+
# Re-raise other AnalysisException errors with original message
|
|
124
|
+
raise
|
|
115
125
|
except Exception as err:
|
|
116
126
|
raise ReadOperationFailedError(
|
|
117
127
|
f"An error occurred while reading the stream from table '{table_identifier}': {err}"
|
|
@@ -25,11 +25,11 @@ cloe_nessy/integration/delta_loader/delta_loader.py,sha256=WOl44Udvo6hZ5PVFgabpe
|
|
|
25
25
|
cloe_nessy/integration/delta_loader/delta_loader_factory.py,sha256=vB1cL6-Nc3SkLH1xtazMbMF1MnNYq8-g3GHZzRE3QmE,2251
|
|
26
26
|
cloe_nessy/integration/delta_loader/delta_loader_metadata_table.py,sha256=G_EWUY76ZlbsPZB9LCGlOLVezk7DK6peYXEgt7-sTQE,1683
|
|
27
27
|
cloe_nessy/integration/delta_loader/strategies/__init__.py,sha256=1o5fRWenL5KnUg1hf7kmTuTpG9pbMxchiQTub52Qvwo,255
|
|
28
|
-
cloe_nessy/integration/delta_loader/strategies/delta_cdf_loader.py,sha256=
|
|
28
|
+
cloe_nessy/integration/delta_loader/strategies/delta_cdf_loader.py,sha256=kbBr0w5yqIwyohWjDosRBzEPKFyebPGxB96uB5f0FyY,17104
|
|
29
29
|
cloe_nessy/integration/delta_loader/strategies/delta_timestamp_loader.py,sha256=QV2smynYVfi3W7goKotPrGMPkahvIFEWT32LO56eWEI,6191
|
|
30
30
|
cloe_nessy/integration/reader/__init__.py,sha256=NWQx-v6aKE8YOHhsxfeaZnMVq4KLKyRWXzUduf5aVsk,265
|
|
31
31
|
cloe_nessy/integration/reader/api_reader.py,sha256=H6alDoCuGsxuhxpuN-JbL9-eMDchE9ZMq9P0hnz7t1I,20007
|
|
32
|
-
cloe_nessy/integration/reader/catalog_reader.py,sha256=
|
|
32
|
+
cloe_nessy/integration/reader/catalog_reader.py,sha256=hOXZMmsvDnTrICHU1DMwkeDYrJX8ZVLXMwg5n2zOnCU,5494
|
|
33
33
|
cloe_nessy/integration/reader/excel_reader.py,sha256=dq_XbuQ_BcQwFuxld-12vzBA2F7hVhNkmMJvgAM-_R8,7937
|
|
34
34
|
cloe_nessy/integration/reader/exceptions.py,sha256=_A9jFpe_RIDZCGY76qzjic9bsshxns6yXPSl141dq1c,203
|
|
35
35
|
cloe_nessy/integration/reader/file_reader.py,sha256=1pf3kVk8UMEf0JPQiwhMLIszl55aLYaEDwS2Fp_9TT8,8261
|
|
@@ -113,6 +113,6 @@ cloe_nessy/settings/settings.py,sha256=I4n129lrujriW-d8q4as2Kb4_kI932ModfZ5Ow_Up
|
|
|
113
113
|
cloe_nessy/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
114
114
|
cloe_nessy/utils/column_names.py,sha256=dCNtm61mc5aLkY2oE4rlfN3VLCrpot6fOESjAZmCmhA,361
|
|
115
115
|
cloe_nessy/utils/file_and_directory_handler.py,sha256=r2EVt9xG81p6ScaJCwETC5an6pMT6WseB0jMOR-JlpU,602
|
|
116
|
-
cloe_nessy-1.0.
|
|
117
|
-
cloe_nessy-1.0.
|
|
118
|
-
cloe_nessy-1.0.
|
|
116
|
+
cloe_nessy-1.0.6.dist-info/METADATA,sha256=wN6TtcRYZiwt-HofDf5IriH6HG2YkvpdFP_uXj7O1Es,3289
|
|
117
|
+
cloe_nessy-1.0.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
118
|
+
cloe_nessy-1.0.6.dist-info/RECORD,,
|
|
File without changes
|