pylegend 0.5.0__py3-none-any.whl → 0.7.0__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.
- pylegend/__init__.py +7 -0
- pylegend/core/language/shared/helpers.py +1 -9
- pylegend/core/language/shared/operations/binary_expression.py +22 -22
- pylegend/core/language/shared/operations/boolean_operation_expressions.py +13 -16
- pylegend/core/language/shared/operations/date_operation_expressions.py +84 -42
- pylegend/core/language/shared/operations/float_operation_expressions.py +20 -25
- pylegend/core/language/shared/operations/integer_operation_expressions.py +25 -30
- pylegend/core/language/shared/operations/nullary_expression.py +6 -1
- pylegend/core/language/shared/operations/number_operation_expressions.py +109 -90
- pylegend/core/language/shared/operations/primitive_operation_expressions.py +8 -16
- pylegend/core/language/shared/operations/string_operation_expressions.py +43 -26
- pylegend/core/language/shared/operations/unary_expression.py +16 -1
- pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py +1 -1
- pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_function_input_frame.py +46 -0
- pylegend/legendql_api_tds_client.py +73 -0
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info}/METADATA +5 -2
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info}/RECORD +21 -19
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info}/WHEEL +1 -1
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info/licenses}/LICENSE +0 -0
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info/licenses}/LICENSE.spdx +0 -0
- {pylegend-0.5.0.dist-info → pylegend-0.7.0.dist-info/licenses}/NOTICE +0 -0
|
@@ -65,12 +65,10 @@ class PyLegendPrimitiveEqualsExpression(PyLegendBinaryExpression, PyLegendExpres
|
|
|
65
65
|
operand1,
|
|
66
66
|
operand2,
|
|
67
67
|
PyLegendPrimitiveEqualsExpression.__to_sql_func,
|
|
68
|
-
PyLegendPrimitiveEqualsExpression.__to_pure_func
|
|
68
|
+
PyLegendPrimitiveEqualsExpression.__to_pure_func,
|
|
69
|
+
non_nullable=True,
|
|
69
70
|
)
|
|
70
71
|
|
|
71
|
-
def is_non_nullable(self) -> bool:
|
|
72
|
-
return True
|
|
73
|
-
|
|
74
72
|
|
|
75
73
|
class PyLegendPrimitiveNotEqualsExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
76
74
|
|
|
@@ -94,12 +92,10 @@ class PyLegendPrimitiveNotEqualsExpression(PyLegendBinaryExpression, PyLegendExp
|
|
|
94
92
|
operand1,
|
|
95
93
|
operand2,
|
|
96
94
|
PyLegendPrimitiveNotEqualsExpression.__to_sql_func,
|
|
97
|
-
PyLegendPrimitiveNotEqualsExpression.__to_pure_func
|
|
95
|
+
PyLegendPrimitiveNotEqualsExpression.__to_pure_func,
|
|
96
|
+
non_nullable=True,
|
|
98
97
|
)
|
|
99
98
|
|
|
100
|
-
def is_non_nullable(self) -> bool:
|
|
101
|
-
return True
|
|
102
|
-
|
|
103
99
|
|
|
104
100
|
class PyLegendIsEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBooleanReturn):
|
|
105
101
|
|
|
@@ -121,12 +117,10 @@ class PyLegendIsEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBoole
|
|
|
121
117
|
self,
|
|
122
118
|
operand,
|
|
123
119
|
PyLegendIsEmptyExpression.__to_sql_func,
|
|
124
|
-
PyLegendIsEmptyExpression.__to_pure_func
|
|
120
|
+
PyLegendIsEmptyExpression.__to_pure_func,
|
|
121
|
+
non_nullable=True,
|
|
125
122
|
)
|
|
126
123
|
|
|
127
|
-
def is_non_nullable(self) -> bool:
|
|
128
|
-
return True
|
|
129
|
-
|
|
130
124
|
|
|
131
125
|
class PyLegendIsNotEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBooleanReturn):
|
|
132
126
|
|
|
@@ -148,8 +142,6 @@ class PyLegendIsNotEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBo
|
|
|
148
142
|
self,
|
|
149
143
|
operand,
|
|
150
144
|
PyLegendIsNotEmptyExpression.__to_sql_func,
|
|
151
|
-
PyLegendIsNotEmptyExpression.__to_pure_func
|
|
145
|
+
PyLegendIsNotEmptyExpression.__to_pure_func,
|
|
146
|
+
non_nullable=True,
|
|
152
147
|
)
|
|
153
|
-
|
|
154
|
-
def is_non_nullable(self) -> bool:
|
|
155
|
-
return True
|
|
@@ -84,7 +84,7 @@ class PyLegendStringLengthExpression(PyLegendUnaryExpression, PyLegendExpression
|
|
|
84
84
|
|
|
85
85
|
@staticmethod
|
|
86
86
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
87
|
-
return generate_pure_functional_call("length", [op_expr]
|
|
87
|
+
return generate_pure_functional_call("length", [op_expr])
|
|
88
88
|
|
|
89
89
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
90
90
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
@@ -92,7 +92,9 @@ class PyLegendStringLengthExpression(PyLegendUnaryExpression, PyLegendExpression
|
|
|
92
92
|
self,
|
|
93
93
|
operand,
|
|
94
94
|
PyLegendStringLengthExpression.__to_sql_func,
|
|
95
|
-
PyLegendStringLengthExpression.__to_pure_func
|
|
95
|
+
PyLegendStringLengthExpression.__to_pure_func,
|
|
96
|
+
non_nullable=True,
|
|
97
|
+
operand_needs_to_be_non_nullable=True,
|
|
96
98
|
)
|
|
97
99
|
|
|
98
100
|
|
|
@@ -192,7 +194,7 @@ class PyLegendStringUpperExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
192
194
|
|
|
193
195
|
@staticmethod
|
|
194
196
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
195
|
-
return generate_pure_functional_call("toUpper", [op_expr]
|
|
197
|
+
return generate_pure_functional_call("toUpper", [op_expr])
|
|
196
198
|
|
|
197
199
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
198
200
|
PyLegendExpressionStringReturn.__init__(self)
|
|
@@ -200,7 +202,9 @@ class PyLegendStringUpperExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
200
202
|
self,
|
|
201
203
|
operand,
|
|
202
204
|
PyLegendStringUpperExpression.__to_sql_func,
|
|
203
|
-
PyLegendStringUpperExpression.__to_pure_func
|
|
205
|
+
PyLegendStringUpperExpression.__to_pure_func,
|
|
206
|
+
non_nullable=True,
|
|
207
|
+
operand_needs_to_be_non_nullable=True,
|
|
204
208
|
)
|
|
205
209
|
|
|
206
210
|
|
|
@@ -216,7 +220,7 @@ class PyLegendStringLowerExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
216
220
|
|
|
217
221
|
@staticmethod
|
|
218
222
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
219
|
-
return generate_pure_functional_call("toLower", [op_expr]
|
|
223
|
+
return generate_pure_functional_call("toLower", [op_expr])
|
|
220
224
|
|
|
221
225
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
222
226
|
PyLegendExpressionStringReturn.__init__(self)
|
|
@@ -224,7 +228,9 @@ class PyLegendStringLowerExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
224
228
|
self,
|
|
225
229
|
operand,
|
|
226
230
|
PyLegendStringLowerExpression.__to_sql_func,
|
|
227
|
-
PyLegendStringLowerExpression.__to_pure_func
|
|
231
|
+
PyLegendStringLowerExpression.__to_pure_func,
|
|
232
|
+
non_nullable=True,
|
|
233
|
+
operand_needs_to_be_non_nullable=True,
|
|
228
234
|
)
|
|
229
235
|
|
|
230
236
|
|
|
@@ -240,7 +246,7 @@ class PyLegendStringLTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
240
246
|
|
|
241
247
|
@staticmethod
|
|
242
248
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
243
|
-
return generate_pure_functional_call("ltrim", [op_expr]
|
|
249
|
+
return generate_pure_functional_call("ltrim", [op_expr])
|
|
244
250
|
|
|
245
251
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
246
252
|
PyLegendExpressionStringReturn.__init__(self)
|
|
@@ -248,7 +254,9 @@ class PyLegendStringLTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
248
254
|
self,
|
|
249
255
|
operand,
|
|
250
256
|
PyLegendStringLTrimExpression.__to_sql_func,
|
|
251
|
-
PyLegendStringLTrimExpression.__to_pure_func
|
|
257
|
+
PyLegendStringLTrimExpression.__to_pure_func,
|
|
258
|
+
non_nullable=True,
|
|
259
|
+
operand_needs_to_be_non_nullable=True,
|
|
252
260
|
)
|
|
253
261
|
|
|
254
262
|
|
|
@@ -264,7 +272,7 @@ class PyLegendStringRTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
264
272
|
|
|
265
273
|
@staticmethod
|
|
266
274
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
267
|
-
return generate_pure_functional_call("rtrim", [op_expr]
|
|
275
|
+
return generate_pure_functional_call("rtrim", [op_expr])
|
|
268
276
|
|
|
269
277
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
270
278
|
PyLegendExpressionStringReturn.__init__(self)
|
|
@@ -272,7 +280,9 @@ class PyLegendStringRTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
272
280
|
self,
|
|
273
281
|
operand,
|
|
274
282
|
PyLegendStringRTrimExpression.__to_sql_func,
|
|
275
|
-
PyLegendStringRTrimExpression.__to_pure_func
|
|
283
|
+
PyLegendStringRTrimExpression.__to_pure_func,
|
|
284
|
+
non_nullable=True,
|
|
285
|
+
operand_needs_to_be_non_nullable=True,
|
|
276
286
|
)
|
|
277
287
|
|
|
278
288
|
|
|
@@ -288,7 +298,7 @@ class PyLegendStringBTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
288
298
|
|
|
289
299
|
@staticmethod
|
|
290
300
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
291
|
-
return generate_pure_functional_call("trim", [op_expr]
|
|
301
|
+
return generate_pure_functional_call("trim", [op_expr])
|
|
292
302
|
|
|
293
303
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
294
304
|
PyLegendExpressionStringReturn.__init__(self)
|
|
@@ -296,7 +306,9 @@ class PyLegendStringBTrimExpression(PyLegendUnaryExpression, PyLegendExpressionS
|
|
|
296
306
|
self,
|
|
297
307
|
operand,
|
|
298
308
|
PyLegendStringBTrimExpression.__to_sql_func,
|
|
299
|
-
PyLegendStringBTrimExpression.__to_pure_func
|
|
309
|
+
PyLegendStringBTrimExpression.__to_pure_func,
|
|
310
|
+
non_nullable=True,
|
|
311
|
+
operand_needs_to_be_non_nullable=True,
|
|
300
312
|
)
|
|
301
313
|
|
|
302
314
|
|
|
@@ -313,7 +325,7 @@ class PyLegendStringPosExpression(PyLegendBinaryExpression, PyLegendExpressionIn
|
|
|
313
325
|
|
|
314
326
|
@staticmethod
|
|
315
327
|
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
316
|
-
return generate_pure_functional_call("indexOf", [op1_expr, op2_expr]
|
|
328
|
+
return generate_pure_functional_call("indexOf", [op1_expr, op2_expr])
|
|
317
329
|
|
|
318
330
|
def __init__(self, operand1: PyLegendExpressionStringReturn, operand2: PyLegendExpressionStringReturn) -> None:
|
|
319
331
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
@@ -322,12 +334,12 @@ class PyLegendStringPosExpression(PyLegendBinaryExpression, PyLegendExpressionIn
|
|
|
322
334
|
operand1,
|
|
323
335
|
operand2,
|
|
324
336
|
PyLegendStringPosExpression.__to_sql_func,
|
|
325
|
-
PyLegendStringPosExpression.__to_pure_func
|
|
337
|
+
PyLegendStringPosExpression.__to_pure_func,
|
|
338
|
+
non_nullable=True,
|
|
339
|
+
first_operand_needs_to_be_non_nullable=True,
|
|
340
|
+
second_operand_needs_to_be_non_nullable=True
|
|
326
341
|
)
|
|
327
342
|
|
|
328
|
-
def to_pure_expression(self, config: FrameToPureConfig) -> str:
|
|
329
|
-
return PyLegendBinaryExpression.to_pure_expression_with_to_one_on_second_operand(self, config)
|
|
330
|
-
|
|
331
343
|
|
|
332
344
|
class PyLegendStringParseIntExpression(PyLegendUnaryExpression, PyLegendExpressionIntegerReturn):
|
|
333
345
|
|
|
@@ -341,7 +353,7 @@ class PyLegendStringParseIntExpression(PyLegendUnaryExpression, PyLegendExpressi
|
|
|
341
353
|
|
|
342
354
|
@staticmethod
|
|
343
355
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
344
|
-
return generate_pure_functional_call("parseInteger", [op_expr]
|
|
356
|
+
return generate_pure_functional_call("parseInteger", [op_expr])
|
|
345
357
|
|
|
346
358
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
347
359
|
PyLegendExpressionIntegerReturn.__init__(self)
|
|
@@ -349,7 +361,9 @@ class PyLegendStringParseIntExpression(PyLegendUnaryExpression, PyLegendExpressi
|
|
|
349
361
|
self,
|
|
350
362
|
operand,
|
|
351
363
|
PyLegendStringParseIntExpression.__to_sql_func,
|
|
352
|
-
PyLegendStringParseIntExpression.__to_pure_func
|
|
364
|
+
PyLegendStringParseIntExpression.__to_pure_func,
|
|
365
|
+
non_nullable=True,
|
|
366
|
+
operand_needs_to_be_non_nullable=True,
|
|
353
367
|
)
|
|
354
368
|
|
|
355
369
|
|
|
@@ -365,7 +379,7 @@ class PyLegendStringParseFloatExpression(PyLegendUnaryExpression, PyLegendExpres
|
|
|
365
379
|
|
|
366
380
|
@staticmethod
|
|
367
381
|
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
368
|
-
return generate_pure_functional_call("parseFloat", [op_expr]
|
|
382
|
+
return generate_pure_functional_call("parseFloat", [op_expr])
|
|
369
383
|
|
|
370
384
|
def __init__(self, operand: PyLegendExpressionStringReturn) -> None:
|
|
371
385
|
PyLegendExpressionFloatReturn.__init__(self)
|
|
@@ -373,7 +387,9 @@ class PyLegendStringParseFloatExpression(PyLegendUnaryExpression, PyLegendExpres
|
|
|
373
387
|
self,
|
|
374
388
|
operand,
|
|
375
389
|
PyLegendStringParseFloatExpression.__to_sql_func,
|
|
376
|
-
PyLegendStringParseFloatExpression.__to_pure_func
|
|
390
|
+
PyLegendStringParseFloatExpression.__to_pure_func,
|
|
391
|
+
non_nullable=True,
|
|
392
|
+
operand_needs_to_be_non_nullable=True,
|
|
377
393
|
)
|
|
378
394
|
|
|
379
395
|
|
|
@@ -399,12 +415,12 @@ class PyLegendStringConcatExpression(PyLegendBinaryExpression, PyLegendExpressio
|
|
|
399
415
|
operand1,
|
|
400
416
|
operand2,
|
|
401
417
|
PyLegendStringConcatExpression.__to_sql_func,
|
|
402
|
-
PyLegendStringConcatExpression.__to_pure_func
|
|
418
|
+
PyLegendStringConcatExpression.__to_pure_func,
|
|
419
|
+
non_nullable=True,
|
|
420
|
+
first_operand_needs_to_be_non_nullable=True,
|
|
421
|
+
second_operand_needs_to_be_non_nullable=True
|
|
403
422
|
)
|
|
404
423
|
|
|
405
|
-
def to_pure_expression(self, config: FrameToPureConfig) -> str:
|
|
406
|
-
return PyLegendBinaryExpression.to_pure_expression_with_to_one_on_both_operands(self, config)
|
|
407
|
-
|
|
408
424
|
|
|
409
425
|
class PyLegendStringLessThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
410
426
|
|
|
@@ -528,7 +544,8 @@ class PyLegendCurrentUserExpression(PyLegendNullaryExpression, PyLegendExpressio
|
|
|
528
544
|
PyLegendNullaryExpression.__init__(
|
|
529
545
|
self,
|
|
530
546
|
PyLegendCurrentUserExpression.__to_sql_func,
|
|
531
|
-
PyLegendCurrentUserExpression.__to_pure_func
|
|
547
|
+
PyLegendCurrentUserExpression.__to_pure_func,
|
|
548
|
+
non_nullable=True
|
|
532
549
|
)
|
|
533
550
|
|
|
534
551
|
|
|
@@ -21,6 +21,7 @@ from pylegend._typing import (
|
|
|
21
21
|
from pylegend.core.language.shared.expression import (
|
|
22
22
|
PyLegendExpression,
|
|
23
23
|
)
|
|
24
|
+
from pylegend.core.language.shared.helpers import expr_has_matching_start_and_end_parentheses
|
|
24
25
|
from pylegend.core.sql.metamodel import (
|
|
25
26
|
Expression,
|
|
26
27
|
QuerySpecification,
|
|
@@ -41,6 +42,8 @@ class PyLegendUnaryExpression(PyLegendExpression, metaclass=ABCMeta):
|
|
|
41
42
|
Expression
|
|
42
43
|
]
|
|
43
44
|
__to_pure_func: PyLegendCallable[[str, FrameToPureConfig], str]
|
|
45
|
+
__non_nullable: bool
|
|
46
|
+
__operand_needs_to_be_non_nullable: bool
|
|
44
47
|
|
|
45
48
|
def __init__(
|
|
46
49
|
self,
|
|
@@ -49,11 +52,15 @@ class PyLegendUnaryExpression(PyLegendExpression, metaclass=ABCMeta):
|
|
|
49
52
|
[Expression, PyLegendDict[str, QuerySpecification], FrameToSqlConfig],
|
|
50
53
|
Expression
|
|
51
54
|
],
|
|
52
|
-
to_pure_func: PyLegendCallable[[str, FrameToPureConfig], str]
|
|
55
|
+
to_pure_func: PyLegendCallable[[str, FrameToPureConfig], str],
|
|
56
|
+
non_nullable: bool = False,
|
|
57
|
+
operand_needs_to_be_non_nullable: bool = False,
|
|
53
58
|
) -> None:
|
|
54
59
|
self.__operand = operand
|
|
55
60
|
self.__to_sql_func = to_sql_func
|
|
56
61
|
self.__to_pure_func = to_pure_func
|
|
62
|
+
self.__non_nullable = non_nullable
|
|
63
|
+
self.__operand_needs_to_be_non_nullable = operand_needs_to_be_non_nullable
|
|
57
64
|
|
|
58
65
|
def to_sql_expression(
|
|
59
66
|
self,
|
|
@@ -69,4 +76,12 @@ class PyLegendUnaryExpression(PyLegendExpression, metaclass=ABCMeta):
|
|
|
69
76
|
|
|
70
77
|
def to_pure_expression(self, config: FrameToPureConfig) -> str:
|
|
71
78
|
op_expr = self.__operand.to_pure_expression(config)
|
|
79
|
+
if self.__operand_needs_to_be_non_nullable:
|
|
80
|
+
op_expr = (
|
|
81
|
+
op_expr if self.__operand.is_non_nullable() else
|
|
82
|
+
f"toOne({op_expr[1:-1] if expr_has_matching_start_and_end_parentheses(op_expr) else op_expr})"
|
|
83
|
+
)
|
|
72
84
|
return self.__to_pure_func(op_expr, config)
|
|
85
|
+
|
|
86
|
+
def is_non_nullable(self) -> bool:
|
|
87
|
+
return self.__non_nullable
|
|
@@ -186,7 +186,7 @@ class LegendQLApiWindowExtendFunction(LegendQLApiAppliedFunction):
|
|
|
186
186
|
|
|
187
187
|
def to_sql(self, config: FrameToSqlConfig) -> QuerySpecification:
|
|
188
188
|
base_query = self.__base_frame.to_sql_query_object(config)
|
|
189
|
-
should_create_sub_query =
|
|
189
|
+
should_create_sub_query = True
|
|
190
190
|
db_extension = config.sql_to_string_generator().get_db_extension()
|
|
191
191
|
|
|
192
192
|
new_query = (
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Copyright 2025 Goldman Sachs
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from pylegend._typing import (
|
|
16
|
+
PyLegendSequence
|
|
17
|
+
)
|
|
18
|
+
from pylegend.core.tds.legendql_api.frames.legendql_api_input_tds_frame import LegendQLApiExecutableInputTdsFrame
|
|
19
|
+
from pylegend.core.project_cooridnates import ProjectCoordinates
|
|
20
|
+
from pylegend.core.request.legend_client import LegendClient
|
|
21
|
+
from pylegend.extensions.tds.abstract.legend_function_input_frame import LegendFunctionInputFrameAbstract
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
__all__: PyLegendSequence[str] = [
|
|
25
|
+
"LegendQLApiLegendFunctionInputFrame"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class LegendQLApiLegendFunctionInputFrame(LegendFunctionInputFrameAbstract, LegendQLApiExecutableInputTdsFrame):
|
|
30
|
+
|
|
31
|
+
def __init__(
|
|
32
|
+
self,
|
|
33
|
+
path: str,
|
|
34
|
+
project_coordinates: ProjectCoordinates,
|
|
35
|
+
legend_client: LegendClient,
|
|
36
|
+
) -> None:
|
|
37
|
+
LegendFunctionInputFrameAbstract.__init__(self, path=path, project_coordinates=project_coordinates)
|
|
38
|
+
LegendQLApiExecutableInputTdsFrame.__init__(
|
|
39
|
+
self,
|
|
40
|
+
legend_client=legend_client,
|
|
41
|
+
columns=legend_client.get_sql_string_schema(self.to_sql_query())
|
|
42
|
+
)
|
|
43
|
+
LegendFunctionInputFrameAbstract.set_initialized(self, True)
|
|
44
|
+
|
|
45
|
+
def __str__(self) -> str:
|
|
46
|
+
return f"LegendQLApiLegendFunctionInputFrame({'.'.join(self.get_path())})"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Copyright 2025 Goldman Sachs
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from pylegend._typing import (
|
|
17
|
+
PyLegendSequence,
|
|
18
|
+
)
|
|
19
|
+
from pylegend.core.request import LegendClient
|
|
20
|
+
from pylegend.core.project_cooridnates import ProjectCoordinates
|
|
21
|
+
from pylegend.core.tds.legendql_api.frames.legendql_api_tds_frame import LegendQLApiTdsFrame
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
__all__: PyLegendSequence[str] = [
|
|
25
|
+
"LegendQLApiTdsClient",
|
|
26
|
+
"legendql_api_tds_client",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class LegendQLApiTdsClient:
|
|
31
|
+
__legend_client: LegendClient
|
|
32
|
+
|
|
33
|
+
def __init__(
|
|
34
|
+
self,
|
|
35
|
+
legend_client: LegendClient
|
|
36
|
+
) -> None:
|
|
37
|
+
self.__legend_client = legend_client
|
|
38
|
+
|
|
39
|
+
def legend_service_frame(
|
|
40
|
+
self,
|
|
41
|
+
service_pattern: str,
|
|
42
|
+
project_coordinates: ProjectCoordinates
|
|
43
|
+
) -> LegendQLApiTdsFrame:
|
|
44
|
+
from pylegend.extensions.tds.legendql_api.frames.legendql_api_legend_service_input_frame import (
|
|
45
|
+
LegendQLApiLegendServiceInputFrame
|
|
46
|
+
)
|
|
47
|
+
return LegendQLApiLegendServiceInputFrame(
|
|
48
|
+
pattern=service_pattern,
|
|
49
|
+
project_coordinates=project_coordinates,
|
|
50
|
+
legend_client=self.__legend_client
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def legend_function_frame(
|
|
54
|
+
self,
|
|
55
|
+
function_path: str,
|
|
56
|
+
project_coordinates: ProjectCoordinates
|
|
57
|
+
) -> LegendQLApiTdsFrame:
|
|
58
|
+
from pylegend.extensions.tds.legendql_api.frames.legendql_api_legend_function_input_frame import (
|
|
59
|
+
LegendQLApiLegendFunctionInputFrame
|
|
60
|
+
)
|
|
61
|
+
return LegendQLApiLegendFunctionInputFrame(
|
|
62
|
+
path=function_path,
|
|
63
|
+
project_coordinates=project_coordinates,
|
|
64
|
+
legend_client=self.__legend_client
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def legendql_api_tds_client(
|
|
69
|
+
legend_client: LegendClient
|
|
70
|
+
) -> LegendQLApiTdsClient:
|
|
71
|
+
return LegendQLApiTdsClient(
|
|
72
|
+
legend_client=legend_client
|
|
73
|
+
)
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: pylegend
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Python language binding for Legend data management platform
|
|
5
5
|
License: Apache-2.0
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
License-File: LICENSE.spdx
|
|
8
|
+
License-File: NOTICE
|
|
6
9
|
Author: PyLegend Maintainers
|
|
7
10
|
Author-email: legend@finos.org
|
|
8
11
|
Requires-Python: >=3.9,<3.14
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pylegend/__init__.py,sha256=
|
|
1
|
+
pylegend/__init__.py,sha256=wSvcilz-fuNv3iisVZh9juoBNv1ov0GJF6hnQhBK4U4,1832
|
|
2
2
|
pylegend/_typing.py,sha256=3P2K9xyyODrYRx3iDI8jtF1vGGqPbYiKqLEN9bBCdi0,1479
|
|
3
3
|
pylegend/core/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
4
4
|
pylegend/core/database/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
@@ -17,20 +17,20 @@ pylegend/core/language/shared/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8
|
|
|
17
17
|
pylegend/core/language/shared/column_expressions.py,sha256=qWHVvwPGwKroQX94a_ovUrxCPnosVMX3tBWlTj7uJ6k,4333
|
|
18
18
|
pylegend/core/language/shared/expression.py,sha256=-XDJ3JfkyQ2FunACUEGI4CeTgqCvBexp55_YCaZUD1k,2446
|
|
19
19
|
pylegend/core/language/shared/functions.py,sha256=G94EiFdZV4jorJTX23ErxKP1GusKl61G3qQN1e26Zws,1495
|
|
20
|
-
pylegend/core/language/shared/helpers.py,sha256=
|
|
20
|
+
pylegend/core/language/shared/helpers.py,sha256=E7IKZwb__qj4_JpoBT2cra_umvfKP58c5U5bygMqh_o,2379
|
|
21
21
|
pylegend/core/language/shared/literal_expressions.py,sha256=bU9pO-H9DxNyDlWVMiJC__YPzHQLo_v9aedllozBzVo,6185
|
|
22
22
|
pylegend/core/language/shared/operations/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
23
|
-
pylegend/core/language/shared/operations/binary_expression.py,sha256=
|
|
24
|
-
pylegend/core/language/shared/operations/boolean_operation_expressions.py,sha256=
|
|
23
|
+
pylegend/core/language/shared/operations/binary_expression.py,sha256=I3CIWwbKlKq1R8ekUXY8QKyHro8b7fIgeM8hTPwN5jA,4006
|
|
24
|
+
pylegend/core/language/shared/operations/boolean_operation_expressions.py,sha256=6NYAilcC6QEn4J_mWTZdDCJhbPMam36Xl6Ai9N1kJsQ,4630
|
|
25
25
|
pylegend/core/language/shared/operations/collection_operation_expressions.py,sha256=PuyICSjPadQNWkp8aZnCZblRnG_uh7lPEXMDN9nwKRI,22412
|
|
26
|
-
pylegend/core/language/shared/operations/date_operation_expressions.py,sha256=
|
|
27
|
-
pylegend/core/language/shared/operations/float_operation_expressions.py,sha256=
|
|
28
|
-
pylegend/core/language/shared/operations/integer_operation_expressions.py,sha256=
|
|
29
|
-
pylegend/core/language/shared/operations/nullary_expression.py,sha256=
|
|
30
|
-
pylegend/core/language/shared/operations/number_operation_expressions.py,sha256=
|
|
31
|
-
pylegend/core/language/shared/operations/primitive_operation_expressions.py,sha256=
|
|
32
|
-
pylegend/core/language/shared/operations/string_operation_expressions.py,sha256=
|
|
33
|
-
pylegend/core/language/shared/operations/unary_expression.py,sha256=
|
|
26
|
+
pylegend/core/language/shared/operations/date_operation_expressions.py,sha256=NFgOjS2GyviFIq2eR7wT1niO2NIGr8FeeYNIhmDjig0,27905
|
|
27
|
+
pylegend/core/language/shared/operations/float_operation_expressions.py,sha256=GsKflYlswzfvb2eEqObRgcoO218zdNj3atS-5g8YzJI,6849
|
|
28
|
+
pylegend/core/language/shared/operations/integer_operation_expressions.py,sha256=4LcGyJvGyraoSP26_JI6VhLGETahKiVVG9qEvMIBt4U,8142
|
|
29
|
+
pylegend/core/language/shared/operations/nullary_expression.py,sha256=dMq3hi7_t0TFboOoQQHjuNZ7D9hLYfc_NozNaUCJTtI,2242
|
|
30
|
+
pylegend/core/language/shared/operations/number_operation_expressions.py,sha256=sqbjVocq2YwuevLGrpBzg7pJch6QmCYYcqZGK62UsiY,30367
|
|
31
|
+
pylegend/core/language/shared/operations/primitive_operation_expressions.py,sha256=UsNe3RN_HuxIfQwcWI6l2xtTgrLIbrJd2nRPJYCTsXA,5297
|
|
32
|
+
pylegend/core/language/shared/operations/string_operation_expressions.py,sha256=90T02mRtJ2lHSPauD-HXeKyNEVFaJB-Cg4HVQbPGAMk,20886
|
|
33
|
+
pylegend/core/language/shared/operations/unary_expression.py,sha256=1VWE43rN4x4NLc6aL3xRzleK9c_UfrLawlyYgX3SG48,3132
|
|
34
34
|
pylegend/core/language/shared/primitive_collection.py,sha256=ShUtgdZkZ8cKdQJLP5iU_zYDK7piMzWlimvjhnyfnGk,13098
|
|
35
35
|
pylegend/core/language/shared/primitives/__init__.py,sha256=9p7VVRhzeRQwTkxXQBBZuJY6P9V-yX0Q_elviaYIgPg,1649
|
|
36
36
|
pylegend/core/language/shared/primitives/boolean.py,sha256=x0JgS8E9AXv0fkExuCCyD9Paim2xwfU9cn-1Jh3bqtI,4058
|
|
@@ -97,7 +97,7 @@ pylegend/core/tds/legendql_api/frames/functions/legendql_api_rename_function.py,
|
|
|
97
97
|
pylegend/core/tds/legendql_api/frames/functions/legendql_api_select_function.py,sha256=_7lYdKin-aQn5tw1zofuXC3T-DxC6XxSJPSfWJqS_7I,5617
|
|
98
98
|
pylegend/core/tds/legendql_api/frames/functions/legendql_api_slice_function.py,sha256=kt1VH-W-RitF-DUcJWKB73NvxSOeAAXN7deeeAwopw4,3249
|
|
99
99
|
pylegend/core/tds/legendql_api/frames/functions/legendql_api_sort_function.py,sha256=KHfxCCRXMSbIWG3KKuAR1BzThFx0rON8CJ_5g7QUTV4,3665
|
|
100
|
-
pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py,sha256=
|
|
100
|
+
pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py,sha256=TapsKtSgZGaMDK_33NsrvozmuV-VkiWtdJJSdLYSYnM,14253
|
|
101
101
|
pylegend/core/tds/legendql_api/frames/legendql_api_applied_function_tds_frame.py,sha256=kEh2XLoxYucQ6R7i5SKWSElUxbslufh5X5reIzOZbDw,1442
|
|
102
102
|
pylegend/core/tds/legendql_api/frames/legendql_api_base_tds_frame.py,sha256=QOV1NG8Ku9S3MQg_B-GkAvA0z1wEMR6Z1eZSLz3uqa8,17659
|
|
103
103
|
pylegend/core/tds/legendql_api/frames/legendql_api_input_tds_frame.py,sha256=x4rl6ER2ksy_PAcz9vlN_GNXejKpUg_e_YgAynfzS1Q,2147
|
|
@@ -135,6 +135,7 @@ pylegend/extensions/tds/legacy_api/frames/legacy_api_legend_service_input_frame.
|
|
|
135
135
|
pylegend/extensions/tds/legacy_api/frames/legacy_api_table_spec_input_frame.py,sha256=QMNTG82yb0KbI2MgevigvLUSOu4jdkCRWpP6FTGHVEk,1465
|
|
136
136
|
pylegend/extensions/tds/legendql_api/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
137
137
|
pylegend/extensions/tds/legendql_api/frames/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
138
|
+
pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_function_input_frame.py,sha256=wT9bHzfSZ_nIllzx0SIEguUhrM6JdY31798gJAf8Gbc,1834
|
|
138
139
|
pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_service_input_frame.py,sha256=UNvZEn1xbXS1y_1Nv6ibTmMpjq6fbFB66U7Ff9Hve2w,1841
|
|
139
140
|
pylegend/extensions/tds/legendql_api/frames/legendql_api_table_spec_input_frame.py,sha256=hJ4MEHOhSuc4i6iheKQtsbdEWxltD3-ilxpwbJYppPM,1481
|
|
140
141
|
pylegend/extensions/tds/pandas_api/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
@@ -145,11 +146,12 @@ pylegend/extensions/tds/pandas_api/frames/pandas_api_table_spec_input_frame.py,s
|
|
|
145
146
|
pylegend/extensions/tds/result_handler/__init__.py,sha256=NIIUcl39wpSc51IhUUEKtEYlve89Xncq0YEG78Gren4,864
|
|
146
147
|
pylegend/extensions/tds/result_handler/to_pandas_df_result_handler.py,sha256=tvVsxDOzHNTvzjdApIhmeefws5_u0N8Rqm7UvEtj70w,4958
|
|
147
148
|
pylegend/legacy_api_tds_client.py,sha256=IXfo2pdBFV3M3S4RYKJcvudMc_OGdR0yvJhTV-ovI3s,2319
|
|
149
|
+
pylegend/legendql_api_tds_client.py,sha256=oS6NET5pAA-hfVhVvwG6sRF7omyBs_gEYSAgA8Tky8U,2357
|
|
148
150
|
pylegend/utils/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
149
151
|
pylegend/utils/class_utils.py,sha256=t4PpF3jAXS_D6p9TqlSppryNYNOuy5C-kbKn2Kgb4QU,973
|
|
150
|
-
pylegend-0.
|
|
151
|
-
pylegend-0.
|
|
152
|
-
pylegend-0.
|
|
153
|
-
pylegend-0.
|
|
154
|
-
pylegend-0.
|
|
155
|
-
pylegend-0.
|
|
152
|
+
pylegend-0.7.0.dist-info/METADATA,sha256=UnFFbTxMJAH41GLOlNVtSgmA3YnDqqJRxDTT5gTmAzk,4280
|
|
153
|
+
pylegend-0.7.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
154
|
+
pylegend-0.7.0.dist-info/licenses/LICENSE,sha256=AGR96_qQPZO66Gjqq4G6r_g670K35VtW-IobTAkmZJM,11343
|
|
155
|
+
pylegend-0.7.0.dist-info/licenses/LICENSE.spdx,sha256=i7TsBclLotUvMjx9vZ_6S8Pp0r4uknWGw1RwiKBBvQ4,207
|
|
156
|
+
pylegend-0.7.0.dist-info/licenses/NOTICE,sha256=2Lr4FqiscyRI7-vyn7c2z-zqUw2p6x7upJyBvFKkHjk,167
|
|
157
|
+
pylegend-0.7.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|