dve-lumipy-testing 1.0.489__py3-none-any.whl → 1.0.491__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: dve-lumipy-testing
3
- Version: 1.0.489
3
+ Version: 1.0.491
4
4
  Summary: Python library for Luminesce
5
5
  Author: FINBOURNE Technology
6
6
  Author-email: engineering@finbourne.com
@@ -1,6 +1,6 @@
1
1
  lumipy/__init__.py,sha256=Ei0SkyOIPS-aC-ZSdaHwfiH7xWMBelLY-EXJ0--jzUo,443
2
2
  lumipy/_config_manager.py,sha256=0ziIk7EyZb44uDw84Pw9UBrY9PmcMYe92WbgF58xylM,8675
3
- lumipy/client.py,sha256=UmVdbdwVLz25yVBmqZNG8k9ii86h7g8xKQoA1g-IT0s,22611
3
+ lumipy/client.py,sha256=r1Yk8vIUb34qQWFaGWb-omtVndg3lTiL7Wi3lbqbDls,23201
4
4
  lumipy/common.py,sha256=wMCeQ8SdCdPiAqyHmVCTy8Wpxs8uJU7sSbYkgu3k5Ls,1701
5
5
  lumipy/query_job.py,sha256=f13vvK1n4czNNg0Jxq8ACrVHdZ20bRQi2rAV_HlfKBA,5395
6
6
  lumipy/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -12,7 +12,7 @@ lumipy/cli/commands/run.py,sha256=q_mQwPdeRliRG4rCuDcK6GG8M-cwwZpHGGPAaGQRFvg,49
12
12
  lumipy/cli/commands/setup.py,sha256=cdB0SFubk4qV2g2xLI5trNz1JVIfkXmTbFuk6t2TtGw,1761
13
13
  lumipy/cli/commands/test.py,sha256=K0sMcf-IhQHi1aZ6izzdqBCYVvtiqjdicLkMbgP5gJM,4462
14
14
  lumipy/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- lumipy/helpers/backoff_handler.py,sha256=ET8q6uOK4EWoLHiQSf4B662BUcjCHfVl6-GySTsKTvU,773
15
+ lumipy/helpers/backoff_handler.py,sha256=dXz1ISZpT4XZWe8b_mdeCmSUgYeF-uAqsXu3cVBqP20,772
16
16
  lumipy/lumiflex/__init__.py,sha256=3IwIV_MfU2thRLDBl-BmDV0j-oG2LfNAY07WBh0Wlb8,50
17
17
  lumipy/lumiflex/column.py,sha256=qONYKsaanXQlhAHLNVjBvl3tUDjx5SJANNarc7zJ1YI,30585
18
18
  lumipy/lumiflex/table.py,sha256=wTDVgaYN_5cvtzcoThyPDcOGAm4kb3r5qiqzrrNADVs,6793
@@ -57,7 +57,7 @@ lumipy/lumiflex/_table/__init__.py,sha256=FdLm71ndJXKlXjp8zxRrgnmVtIC1RoGrHO1J6B
57
57
  lumipy/lumiflex/_table/base_table.py,sha256=TdNmDCrx2nhmJKE4iFI_vWGgq6YEOVaFZ8ZkIVGunvE,8969
58
58
  lumipy/lumiflex/_table/content.py,sha256=yrMUNvD0pQkh-0XyusfHjSvVyctjPMn2miSiDKwebfc,7519
59
59
  lumipy/lumiflex/_table/join.py,sha256=KrzBjB0CtHLKSYX4D1QN6BOaR8Ct9ADQz7ia9g3LF78,7407
60
- lumipy/lumiflex/_table/operation.py,sha256=ZsqkdOK15S6wtUoqYNhEC8VrrQZ0GVqqTf_jC19mGhE,33422
60
+ lumipy/lumiflex/_table/operation.py,sha256=V9BttjaYY-8CTklgc1CqFhLYMy8xKam7GOfgDgBLnnw,33873
61
61
  lumipy/lumiflex/_table/parameter.py,sha256=7P6RbI8OCMxXZhpgAOSd0oHJW8X1wlfxKPHXBBpimcs,1757
62
62
  lumipy/lumiflex/_table/variable.py,sha256=iqoUqY-AQpHua69VsHciNELppmsDtYbAgb2-9ZEz-cI,9637
63
63
  lumipy/lumiflex/_table/widgets.py,sha256=wCjNE5WXo8DaH7qVlY7WRNQf4dLWweme6uhV5_6_Eh8,2926
@@ -78,7 +78,7 @@ lumipy/provider/common.py,sha256=95210WHs_s2PmFqQBFeIFHm3KeJVbTsy8kOLysvkvD4,696
78
78
  lumipy/provider/context.py,sha256=VwsHZO46HP3G9BN4Eot_jQlbfETGKyNg2vG5wm1zL_4,5401
79
79
  lumipy/provider/factory.py,sha256=QFuSCT_byJwbFmHF669I2iz0vLAF0T9Or1ghIEUZ0ok,9257
80
80
  lumipy/provider/manager.py,sha256=A4bxCO__m5nc9GL8veOLtySbK1giMNDMml_r3B-q8y8,7218
81
- lumipy/provider/max_version.py,sha256=epGae8z1ELH-pPV9B92NLz_cui_BHugM2b3DOQNx_eY,28
81
+ lumipy/provider/max_version.py,sha256=BJIu7KWzYUUI2dJRkFnRJaqG82Py1dV7BW2pVkV9aSs,28
82
82
  lumipy/provider/metadata.py,sha256=WGfMv_tLn5W29-zMKipqBpueroe0eF-w9Hj_6QRdZAI,5483
83
83
  lumipy/provider/provider_sets.py,sha256=Z_VyiN2dBP1xuIdRiuGgyzLD7LfO4wxFvodprME2Uls,1478
84
84
  lumipy/provider/implementation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -378,9 +378,9 @@ lumipy/test/unit/provider_tests/test_provider_api.py,sha256=ZovhykIlIRzEG5jj7-ic
378
378
  lumipy/test/unit/provider_tests/test_provider_factory.py,sha256=ICHlEiYS-GvKFoI5JCTsH17InQfUeYL0uNOHZO6V8a0,6395
379
379
  lumipy/test/unit/provider_tests/test_provider_manager.py,sha256=-TT-3ZGpDsFKMz4efWIy7TGAUVtZ2gTDa67DiorIioc,13456
380
380
  lumipy/test/unit/queryjob_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
381
- lumipy/test/unit/queryjob_tests/test_queryjob.py,sha256=1UE4-VuIkAE6vo0vogq3p2iXtTukiAPxOt5Uankx7c4,1542
382
- dve_lumipy_testing-1.0.489.dist-info/METADATA,sha256=q8nUg1KsPym_jaEZpPB2QVkQVzXcoJCjYZB-H1oLefI,14827
383
- dve_lumipy_testing-1.0.489.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
384
- dve_lumipy_testing-1.0.489.dist-info/entry_points.txt,sha256=L7hRlqwmvzHMwaOQzygKLK-gx4k4e1q4Qz5m0DGihW8,46
385
- dve_lumipy_testing-1.0.489.dist-info/top_level.txt,sha256=DVww8LaQM3Xm0WOgo4JE0epePgCM1xGWWWxh7wuv-CY,7
386
- dve_lumipy_testing-1.0.489.dist-info/RECORD,,
381
+ lumipy/test/unit/queryjob_tests/test_queryjob.py,sha256=CVcMaezQ578Qh_5sukr6BqKMHJxs9Pawiik0J1rVObo,1539
382
+ dve_lumipy_testing-1.0.491.dist-info/METADATA,sha256=oe1hCbGw816lAJSXEVRKY0MiT0vJg3Fml2psIr1PkXo,14827
383
+ dve_lumipy_testing-1.0.491.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
384
+ dve_lumipy_testing-1.0.491.dist-info/entry_points.txt,sha256=L7hRlqwmvzHMwaOQzygKLK-gx4k4e1q4Qz5m0DGihW8,46
385
+ dve_lumipy_testing-1.0.491.dist-info/top_level.txt,sha256=DVww8LaQM3Xm0WOgo4JE0epePgCM1xGWWWxh7wuv-CY,7
386
+ dve_lumipy_testing-1.0.491.dist-info/RECORD,,
lumipy/client.py CHANGED
@@ -1,3 +1,4 @@
1
+ import ast
1
2
  import asyncio
2
3
  import io
3
4
  import json
@@ -126,7 +127,9 @@ class Client:
126
127
  Returns:
127
128
  DataFrame: dataframe containing table field catalog information.
128
129
  """
129
- return pd.DataFrame(json.loads(self._catalog_api.get_catalog()))
130
+ res = self._catalog_api.get_catalog()
131
+ d = ast.literal_eval(res)
132
+ return pd.DataFrame(d)
130
133
 
131
134
  def query_and_fetch(
132
135
  self,
@@ -170,7 +173,14 @@ class Client:
170
173
  """
171
174
  return self._design_api.put_query_to_format(body=_add_lumipy_tag(sql), **pretty_params)
172
175
 
173
- def start_query(self, sql: str, name: Optional[str] = "query", timeout: Optional[int] = 3600, keep_for: Optional[int] = 7200) -> str:
176
+ def start_query(
177
+ self,
178
+ sql: str,
179
+ name: Optional[str] = "query",
180
+ timeout: Optional[int] = 3600,
181
+ keep_for: Optional[int] = 7200,
182
+ correlation_id: Optional[str] = None,
183
+ ) -> str:
174
184
  """Send an asynchronous query to Luminesce. Starts the query but does not wait and fetch the result.
175
185
 
176
186
  Args:
@@ -178,19 +188,26 @@ class Client:
178
188
  name (str): name of the query (defaults to just 'query')
179
189
  timeout (int): max time for the query to run in seconds (defaults to 3600)
180
190
  keep_for (int): time to keep the query result for in seconds (defaults to 7200)
191
+ correlation_id (str): optional correlation id for the query (defaults to None)
181
192
 
182
193
  Returns:
183
194
  str: string containing the execution ID
184
195
 
185
196
  """
186
- res = self._sql_bkg_exec_api.start_query(
197
+ if correlation_id:
198
+ headers_kw = {"_headers": {"CorrelationId": correlation_id, "X-LUSID-Application": "luminesce/lumipy"}}
199
+ else:
200
+ headers_kw = {}
201
+
202
+ res = self._sql_bkg_exec_api.start_query_with_http_info(
187
203
  body=_add_lumipy_tag(sql),
188
204
  query_name=name,
189
205
  timeout_seconds=timeout,
190
- keep_for_seconds=keep_for
206
+ keep_for_seconds=keep_for,
207
+ **headers_kw,
191
208
  )
192
209
 
193
- return res.execution_id
210
+ return res.data.execution_id
194
211
 
195
212
  def get_status(self, execution_id: str) -> Dict[str, str]:
196
213
  """Get the status of a Luminesce query
@@ -280,14 +297,15 @@ class Client:
280
297
  """)
281
298
 
282
299
  def run(
283
- self,
284
- sql: str,
285
- timeout: Optional[int] = 3600,
286
- keep_for: Optional[int] = 7200,
287
- quiet: Optional[bool] = False,
288
- return_job: Optional[bool] = False,
289
- _print_fn: Optional[Callable] = None,
290
- **read_csv_params
300
+ self,
301
+ sql: str,
302
+ timeout: Optional[int] = 3600,
303
+ keep_for: Optional[int] = 7200,
304
+ quiet: Optional[bool] = False,
305
+ return_job: Optional[bool] = False,
306
+ correlation_id: Optional[str] = None,
307
+ _print_fn: Optional[Callable] = None,
308
+ **read_csv_params,
291
309
  ) -> DataFrame:
292
310
  """Run a sql string in Luminesce. This method can either run synchonously which will print query progress to the
293
311
  screen and then return the result or return a QueryJob instance that allows you to manage the query job yourself.
@@ -299,6 +317,7 @@ class Client:
299
317
  quiet (Optional[bool]): whether to print query progress or not
300
318
  return_job (Optional[bool]): whether to return a QueryJob instance or to wait until completion and return
301
319
  the result as a pandas dataframe
320
+ correlation_id: a correlation id for the query (defaults to None)
302
321
  _print_fn (Optional[Callable]): alternative print function for showing progress. This is mainly for internal use with
303
322
  the streamlit utility functions that show query progress in a cell. Defaults to the normal python print() fn.
304
323
  **read_csv_params (Any): keyword arguments to pass down to pandas read_csv. See https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html
@@ -308,7 +327,7 @@ class Client:
308
327
  represents the running query.
309
328
 
310
329
  """
311
- ex_id = self.start_query(sql, timeout=timeout, keep_for=keep_for)
330
+ ex_id = self.start_query(sql, timeout=timeout, keep_for=keep_for, correlation_id=correlation_id)
312
331
  job = QueryJob(ex_id, client=self, _print_fn=_print_fn)
313
332
  if return_job:
314
333
  return job
@@ -4,7 +4,7 @@ import time
4
4
 
5
5
 
6
6
  class BackoffHandler:
7
- def __init__(self, pause_time: Optional[float] = 0.1, max_pause_time: Optional[float] = 10, beta: Optional[float] = math.exp(1/200)):
7
+ def __init__(self, pause_time: Optional[float] = 0.1, max_pause_time: Optional[float] = 10, beta: Optional[float] = math.exp(1/20)):
8
8
  if pause_time < 0.1 or pause_time > max_pause_time:
9
9
  raise ValueError(f"Pause time must be between 0.1 and {max_pause_time}, both inclusive.")
10
10
  if beta < 1:
@@ -35,13 +35,20 @@ class TableOperation(Node, ABC):
35
35
  def content(self):
36
36
  return self.get_parents()[-1]
37
37
 
38
- def go(self, timeout: Optional[int] = 3600, keep_for: Optional[int] = 7200, quiet: Optional[bool] = False) -> DataFrame:
38
+ def go(
39
+ self,
40
+ timeout: Optional[int] = 3600,
41
+ keep_for: Optional[int] = 7200,
42
+ quiet: Optional[bool] = False,
43
+ correlation_id: Optional[str] = None,
44
+ ) -> DataFrame:
39
45
  """Send query off to Luminesce, monitor progress and then get the result back as a pandas dataframe.
40
46
 
41
47
  Args:
42
48
  timeout (Optional[int]): max time for the query to run in seconds (defaults to 3600)
43
49
  keep_for (Optional[int]): time to keep the query result for in seconds (defaults to 7200)
44
50
  quiet (Optional[bool]): whether to print query progress or not
51
+ correlation_id (Optional[str]): correlation id for the query (defaults to None)
45
52
 
46
53
  Returns:
47
54
  DataFrame: the result of the query as a pandas dataframe.
@@ -50,15 +57,23 @@ class TableOperation(Node, ABC):
50
57
  f"-- built with fluent syntax\n{self.get_sql()}",
51
58
  timeout=timeout,
52
59
  keep_for=keep_for,
53
- quiet=quiet
60
+ quiet=quiet,
61
+ correlation_id=correlation_id,
54
62
  )
55
63
 
56
- def go_async(self, timeout: Optional[int] = 3600, keep_for: Optional[int] = 7200, _print_fn: Optional[Callable] = None):
64
+ def go_async(
65
+ self,
66
+ timeout: Optional[int] = 3600,
67
+ keep_for: Optional[int] = 7200,
68
+ correlation_id: Optional[str] = None,
69
+ _print_fn: Optional[Callable] = None,
70
+ ):
57
71
  """Just send the query to luminesce. Don't monitor progress or fetch result, just return a job object.
58
72
 
59
73
  Args:
60
74
  timeout (Optional[int]): max time for the query to run in seconds (defaults to 3600)
61
75
  keep_for (Optional[int]): time to keep the query result for in seconds (defaults to 7200)
76
+ correlation_id (Optional[int]): optional correlation id for the query (defaults to None)
62
77
  _print_fn (Optional[callable]): alternative print function for showing progress. This is mainly for internal use with
63
78
  the streamlit utility functions that show query progress in a cell. Defaults to the normal python print() fn.
64
79
 
@@ -70,7 +85,8 @@ class TableOperation(Node, ABC):
70
85
  timeout=timeout,
71
86
  keep_for=keep_for,
72
87
  return_job=True,
73
- _print_fn=_print_fn
88
+ correlation_id=correlation_id,
89
+ _print_fn=_print_fn,
74
90
  )
75
91
 
76
92
  def get_sql(self) -> str:
@@ -1 +1 @@
1
- max_version_str = '1.18.673'
1
+ max_version_str = '1.18.697'
@@ -23,11 +23,11 @@ class TestQueryJob(unittest.TestCase):
23
23
  def test_default_optional_values(self):
24
24
  backoff_handler_test = BackoffHandler()
25
25
  backoff_handler_test.sleep()
26
- self.assertAlmostEqual(backoff_handler_test.pause_time, 0.1005012520859401, places = 5)
26
+ self.assertAlmostEqual(backoff_handler_test.pause_time, 0.105127109637602, places = 5)
27
27
 
28
28
  def test_call_1000_times_pause_time_equals_max_pause_time(self):
29
29
  backoff_handler_test = BackoffHandler()
30
- # I have checked that this is constant after 922 requests
31
- for i in range(1000):
30
+ # I have checked that this is constant after 94 requests
31
+ for i in range(100):
32
32
  backoff_handler_test._update_pause_time()
33
33
  self.assertEqual(backoff_handler_test.pause_time, 10)