ygg 0.1.37__py3-none-any.whl → 0.1.39__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ygg
3
- Version: 0.1.37
3
+ Version: 0.1.39
4
4
  Summary: Type-friendly utilities for moving data between Python objects, Arrow, Polars, Pandas, Spark, and Databricks
5
5
  Author: Yggdrasil contributors
6
6
  License: Apache License
@@ -1,6 +1,6 @@
1
- ygg-0.1.37.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
1
+ ygg-0.1.39.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
2
2
  yggdrasil/__init__.py,sha256=PfH7Xwt6uue6oqe6S5V8NhDJcVQClkKrBE1KXhdelZc,117
3
- yggdrasil/version.py,sha256=bC2HSZRduanhYcwfv2uqbh4LgiwM3nV4LyoWJhD4ftY,22
3
+ yggdrasil/version.py,sha256=CJmriEgb-Ey3LByW34C3xKdLEpasYF_SIpGuURosS7U,22
4
4
  yggdrasil/databricks/__init__.py,sha256=skctY2c8W-hI81upx9F_PWRe5ishL3hrdiTuizgDjdw,152
5
5
  yggdrasil/databricks/compute/__init__.py,sha256=NvdzmaJSNYY1uJthv1hHdBuNu3bD_-Z65DWnaJt9yXg,289
6
6
  yggdrasil/databricks/compute/cluster.py,sha256=mnNzjCx7X3iK22oZ7K3pqot0AXq9JTdg97kT61j2_UU,40729
@@ -9,9 +9,9 @@ yggdrasil/databricks/compute/remote.py,sha256=nEN_Fr1Ouul_iKOf4B5QjEGscYAcl7nHjG
9
9
  yggdrasil/databricks/jobs/__init__.py,sha256=snxGSJb0M5I39v0y3IR-uEeSlZR248cQ_4DJ1sYs-h8,154
10
10
  yggdrasil/databricks/jobs/config.py,sha256=9LGeHD04hbfy0xt8_6oobC4moKJh4_DTjZiK4Q2Tqjk,11557
11
11
  yggdrasil/databricks/sql/__init__.py,sha256=y1n5yg-drZ8QVZbEgznsRG24kdJSnFis9l2YfYCsaCM,234
12
- yggdrasil/databricks/sql/engine.py,sha256=kUFBddJJQC0AgDqH0l7GFs7d_Ony5rc8fOv4inLU6Vw,41051
12
+ yggdrasil/databricks/sql/engine.py,sha256=Azx3gKtWOMy3D9I2FhkLmpthZPWAJZ9iZkaDivmt_0s,41002
13
13
  yggdrasil/databricks/sql/exceptions.py,sha256=Jqd_gT_VyPL8klJEHYEzpv5eHtmdY43WiQ7HZBaEqSk,53
14
- yggdrasil/databricks/sql/statement_result.py,sha256=KXBLbEpwrjrAeH0ezKNlaa6Vm3jbG3R0ZCnEFHvqpoQ,16834
14
+ yggdrasil/databricks/sql/statement_result.py,sha256=_mBolHae0AASfe1Tlld1KTXs-K4-oy9dniHDyR2ILYc,16736
15
15
  yggdrasil/databricks/sql/types.py,sha256=5G-BM9_eOsRKEMzeDTWUsWW5g4Idvs-czVCpOCrMhdA,6412
16
16
  yggdrasil/databricks/workspaces/__init__.py,sha256=Ti1I99JTC3koYJaCy8WYvkAox4KdcuMRk8b2rHroWCY,133
17
17
  yggdrasil/databricks/workspaces/filesytem.py,sha256=Z8JXU7_XUEbw9fpTQT1avRQKi-IAP2KemXBMPkUoY4w,9805
@@ -55,8 +55,8 @@ yggdrasil/types/cast/registry.py,sha256=_zdFGmUBB7P-e_LIcJlOxMcxAkXoA-UXB6HqLMgT
55
55
  yggdrasil/types/cast/spark_cast.py,sha256=_KAsl1DqmKMSfWxqhVE7gosjYdgiL1C5bDQv6eP3HtA,24926
56
56
  yggdrasil/types/cast/spark_pandas_cast.py,sha256=BuTiWrdCANZCdD_p2MAytqm74eq-rdRXd-LGojBRrfU,5023
57
57
  yggdrasil/types/cast/spark_polars_cast.py,sha256=btmZNHXn2NSt3fUuB4xg7coaE0RezIBdZD92H8NK0Jw,9073
58
- ygg-0.1.37.dist-info/METADATA,sha256=QOawaiOu5RrOUAhuIws2wNB1Nj3CQq38desRezzYMwk,19204
59
- ygg-0.1.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
- ygg-0.1.37.dist-info/entry_points.txt,sha256=6q-vpWG3kvw2dhctQ0LALdatoeefkN855Ev02I1dKGY,70
61
- ygg-0.1.37.dist-info/top_level.txt,sha256=iBe9Kk4VIVbLpgv_p8OZUIfxgj4dgJ5wBg6vO3rigso,10
62
- ygg-0.1.37.dist-info/RECORD,,
58
+ ygg-0.1.39.dist-info/METADATA,sha256=RfbFhLCQfG6s5EO95X0zwf40BZ3SatH5rF5FfoTdIxE,19204
59
+ ygg-0.1.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ ygg-0.1.39.dist-info/entry_points.txt,sha256=6q-vpWG3kvw2dhctQ0LALdatoeefkN855Ev02I1dKGY,70
61
+ ygg-0.1.39.dist-info/top_level.txt,sha256=iBe9Kk4VIVbLpgv_p8OZUIfxgj4dgJ5wBg6vO3rigso,10
62
+ ygg-0.1.39.dist-info/RECORD,,
@@ -309,7 +309,6 @@ class SQLEngine(WorkspaceService):
309
309
  engine=self,
310
310
  statement_id=response.statement_id,
311
311
  _response=response,
312
- _response_refresh_time=time.time(),
313
312
  disposition=disposition,
314
313
  )
315
314
 
@@ -49,6 +49,10 @@ DONE_STATES = {
49
49
  StatementState.SUCCEEDED
50
50
  }
51
51
 
52
+ FAILED_STATES = {
53
+ StatementState.FAILED, StatementState.CANCELED
54
+ }
55
+
52
56
  __all__ = [
53
57
  "StatementResult"
54
58
  ]
@@ -123,16 +127,11 @@ class StatementResult:
123
127
  statement_execution = self.workspace.sdk().statement_execution
124
128
 
125
129
  if self._response is None:
126
- self._response = (
127
- statement_execution
128
- .get_statement(self.statement_id)
129
- )
130
-
131
- if self._response.status.state not in DONE_STATES:
132
- self._response = (
133
- statement_execution
134
- .get_statement(self.statement_id)
135
- )
130
+ # Initialize
131
+ self._response = statement_execution.get_statement(self.statement_id)
132
+ elif self._response.status.state not in DONE_STATES:
133
+ # Refresh
134
+ self._response = statement_execution.get_statement(self.statement_id)
136
135
 
137
136
  return self._response
138
137
 
@@ -196,6 +195,7 @@ class StatementResult:
196
195
  Returns:
197
196
  The result manifest or None for Spark SQL results.
198
197
  """
198
+ self.wait()
199
199
  return self.response.manifest
200
200
 
201
201
  @property
@@ -205,6 +205,7 @@ class StatementResult:
205
205
  Returns:
206
206
  The statement result payload from the API.
207
207
  """
208
+ self.wait()
208
209
  return self.response.result
209
210
 
210
211
  @property
@@ -223,13 +224,7 @@ class StatementResult:
223
224
  Returns:
224
225
  True if the statement failed or was cancelled.
225
226
  """
226
- if self.persisted:
227
- return True
228
-
229
- if self._response is None:
230
- return False
231
-
232
- return self._response.status.state in [StatementState.CANCELED, StatementState.FAILED]
227
+ return self.state in FAILED_STATES
233
228
 
234
229
  @property
235
230
  def persisted(self):
@@ -260,7 +255,6 @@ class StatementResult:
260
255
  self, self.disposition, Disposition.EXTERNAL_LINKS
261
256
  )
262
257
 
263
- self.wait()
264
258
  result_data = self.result
265
259
  wsdk = self.workspace.sdk()
266
260
 
@@ -327,6 +321,8 @@ class StatementResult:
327
321
  f"Statement {self.statement_id} {self.state}: " + " | ".join(parts)
328
322
  )
329
323
 
324
+ return self
325
+
330
326
  def wait(
331
327
  self,
332
328
  timeout: Optional[int] = None,
@@ -346,20 +342,21 @@ class StatementResult:
346
342
 
347
343
  start = time.time()
348
344
  poll_interval = poll_interval or 1
349
- current = self
350
345
 
351
346
  while not self.done:
352
347
  # still running / queued / pending
353
348
  if timeout is not None and (time.time() - start) > timeout:
354
349
  raise TimeoutError(
355
- f"Statement {current.statement_id} did not finish within {timeout} seconds "
356
- f"(last state={current})"
350
+ f"Statement {self.statement_id} did not finish within {timeout} seconds "
351
+ f"(last state={self.state})"
357
352
  )
358
353
 
359
354
  poll_interval = max(10, poll_interval * 1.2)
360
355
  time.sleep(poll_interval)
361
356
 
362
- return current
357
+ self.raise_for_status()
358
+
359
+ return self
363
360
 
364
361
  def arrow_schema(self):
365
362
  """Return the Arrow schema for the result.
yggdrasil/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.37"
1
+ __version__ = "0.1.39"
File without changes