pylegend 0.4.0__py3-none-any.whl → 0.5.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 +9 -1
- pylegend/core/database/sql_to_string/db_extension.py +3 -0
- pylegend/core/language/__init__.py +2 -0
- pylegend/core/language/shared/functions.py +9 -0
- pylegend/core/language/shared/operations/date_operation_expressions.py +124 -0
- pylegend/core/language/shared/operations/primitive_operation_expressions.py +60 -0
- pylegend/core/language/shared/operations/string_operation_expressions.py +25 -0
- pylegend/core/language/shared/primitives/date.py +37 -0
- pylegend/core/language/shared/primitives/primitive.py +16 -0
- pylegend/core/sql/metamodel_extension.py +12 -0
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/METADATA +1 -1
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/RECORD +16 -16
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE +0 -0
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/LICENSE.spdx +0 -0
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/NOTICE +0 -0
- {pylegend-0.4.0.dist-info → pylegend-0.5.0.dist-info}/WHEEL +0 -0
pylegend/__init__.py
CHANGED
|
@@ -32,7 +32,12 @@ from pylegend.core.project_cooridnates import (
|
|
|
32
32
|
PersonalWorkspaceProjectCoordinates,
|
|
33
33
|
GroupWorkspaceProjectCoordinates,
|
|
34
34
|
)
|
|
35
|
-
from pylegend.core.language import
|
|
35
|
+
from pylegend.core.language import (
|
|
36
|
+
agg,
|
|
37
|
+
now,
|
|
38
|
+
today,
|
|
39
|
+
current_user,
|
|
40
|
+
)
|
|
36
41
|
|
|
37
42
|
|
|
38
43
|
__all__: PyLegendSequence[str] = [
|
|
@@ -53,6 +58,9 @@ __all__: PyLegendSequence[str] = [
|
|
|
53
58
|
"GroupWorkspaceProjectCoordinates",
|
|
54
59
|
|
|
55
60
|
"agg",
|
|
61
|
+
"now",
|
|
62
|
+
"today",
|
|
63
|
+
"current_user",
|
|
56
64
|
]
|
|
57
65
|
|
|
58
66
|
|
|
@@ -131,6 +131,7 @@ from pylegend.core.sql.metamodel_extension import (
|
|
|
131
131
|
SecondExpression,
|
|
132
132
|
EpochExpression,
|
|
133
133
|
WindowExpression,
|
|
134
|
+
ConstantExpression,
|
|
134
135
|
)
|
|
135
136
|
|
|
136
137
|
|
|
@@ -451,6 +452,8 @@ def expression_processor(
|
|
|
451
452
|
return extension.process_epoch_expression(expression, config)
|
|
452
453
|
elif isinstance(expression, WindowExpression):
|
|
453
454
|
return extension.process_window_expression(expression, config)
|
|
455
|
+
elif isinstance(expression, ConstantExpression):
|
|
456
|
+
return expression.name
|
|
454
457
|
|
|
455
458
|
else:
|
|
456
459
|
raise ValueError("Unsupported expression type: " + str(type(expression))) # pragma: no cover
|
|
@@ -74,6 +74,7 @@ from pylegend.core.language.shared.primitive_collection import (
|
|
|
74
74
|
from pylegend.core.language.shared.functions import (
|
|
75
75
|
today,
|
|
76
76
|
now,
|
|
77
|
+
current_user,
|
|
77
78
|
)
|
|
78
79
|
|
|
79
80
|
__all__: PyLegendSequence[str] = [
|
|
@@ -132,4 +133,5 @@ __all__: PyLegendSequence[str] = [
|
|
|
132
133
|
|
|
133
134
|
"today",
|
|
134
135
|
"now",
|
|
136
|
+
"current_user",
|
|
135
137
|
]
|
|
@@ -18,15 +18,20 @@ from pylegend._typing import (
|
|
|
18
18
|
)
|
|
19
19
|
from pylegend.core.language.shared.primitives.strictdate import PyLegendStrictDate
|
|
20
20
|
from pylegend.core.language.shared.primitives.datetime import PyLegendDateTime
|
|
21
|
+
from pylegend.core.language.shared.primitives.string import PyLegendString
|
|
21
22
|
from pylegend.core.language.shared.operations.date_operation_expressions import (
|
|
22
23
|
PyLegendTodayExpression,
|
|
23
24
|
PyLegendNowExpression,
|
|
24
25
|
)
|
|
26
|
+
from pylegend.core.language.shared.operations.string_operation_expressions import (
|
|
27
|
+
PyLegendCurrentUserExpression,
|
|
28
|
+
)
|
|
25
29
|
|
|
26
30
|
|
|
27
31
|
__all__: PyLegendSequence[str] = [
|
|
28
32
|
"today",
|
|
29
33
|
"now",
|
|
34
|
+
"current_user",
|
|
30
35
|
]
|
|
31
36
|
|
|
32
37
|
|
|
@@ -36,3 +41,7 @@ def today() -> PyLegendStrictDate:
|
|
|
36
41
|
|
|
37
42
|
def now() -> PyLegendDateTime:
|
|
38
43
|
return PyLegendDateTime(PyLegendNowExpression())
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def current_user() -> PyLegendString:
|
|
47
|
+
return PyLegendString(PyLegendCurrentUserExpression())
|
|
@@ -21,7 +21,9 @@ from pylegend.core.language.shared.expression import (
|
|
|
21
21
|
PyLegendExpressionDateTimeReturn,
|
|
22
22
|
PyLegendExpressionStrictDateReturn,
|
|
23
23
|
PyLegendExpressionIntegerReturn,
|
|
24
|
+
PyLegendExpressionBooleanReturn,
|
|
24
25
|
)
|
|
26
|
+
from pylegend.core.language.shared.operations.binary_expression import PyLegendBinaryExpression
|
|
25
27
|
from pylegend.core.language.shared.operations.nullary_expression import PyLegendNullaryExpression
|
|
26
28
|
from pylegend.core.language.shared.operations.unary_expression import PyLegendUnaryExpression
|
|
27
29
|
from pylegend.core.language.shared.helpers import generate_pure_functional_call
|
|
@@ -36,6 +38,8 @@ from pylegend.core.sql.metamodel import (
|
|
|
36
38
|
CurrentTimeType,
|
|
37
39
|
Cast,
|
|
38
40
|
ColumnType,
|
|
41
|
+
ComparisonExpression,
|
|
42
|
+
ComparisonOperator,
|
|
39
43
|
)
|
|
40
44
|
from pylegend.core.sql.metamodel_extension import (
|
|
41
45
|
FirstDayOfYearExpression,
|
|
@@ -83,6 +87,10 @@ __all__: PyLegendSequence[str] = [
|
|
|
83
87
|
"PyLegendTodayExpression",
|
|
84
88
|
"PyLegendNowExpression",
|
|
85
89
|
"PyLegendDatePartExpression",
|
|
90
|
+
"PyLegendDateLessThanExpression",
|
|
91
|
+
"PyLegendDateLessThanEqualExpression",
|
|
92
|
+
"PyLegendDateGreaterThanExpression",
|
|
93
|
+
"PyLegendDateGreaterThanEqualExpression",
|
|
86
94
|
]
|
|
87
95
|
|
|
88
96
|
|
|
@@ -614,3 +622,119 @@ class PyLegendDatePartExpression(PyLegendUnaryExpression, PyLegendExpressionStri
|
|
|
614
622
|
PyLegendDatePartExpression.__to_sql_func,
|
|
615
623
|
PyLegendDatePartExpression.__to_pure_func
|
|
616
624
|
)
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
class PyLegendDateLessThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
628
|
+
|
|
629
|
+
@staticmethod
|
|
630
|
+
def __to_sql_func(
|
|
631
|
+
expression1: Expression,
|
|
632
|
+
expression2: Expression,
|
|
633
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
634
|
+
config: FrameToSqlConfig
|
|
635
|
+
) -> Expression:
|
|
636
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN)
|
|
637
|
+
|
|
638
|
+
@staticmethod
|
|
639
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
640
|
+
return f"({op1_expr} < {op2_expr})"
|
|
641
|
+
|
|
642
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
643
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
644
|
+
PyLegendBinaryExpression.__init__(
|
|
645
|
+
self,
|
|
646
|
+
operand1,
|
|
647
|
+
operand2,
|
|
648
|
+
PyLegendDateLessThanExpression.__to_sql_func,
|
|
649
|
+
PyLegendDateLessThanExpression.__to_pure_func
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
def is_non_nullable(self) -> bool:
|
|
653
|
+
return True
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
class PyLegendDateLessThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
657
|
+
|
|
658
|
+
@staticmethod
|
|
659
|
+
def __to_sql_func(
|
|
660
|
+
expression1: Expression,
|
|
661
|
+
expression2: Expression,
|
|
662
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
663
|
+
config: FrameToSqlConfig
|
|
664
|
+
) -> Expression:
|
|
665
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.LESS_THAN_OR_EQUAL)
|
|
666
|
+
|
|
667
|
+
@staticmethod
|
|
668
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
669
|
+
return f"({op1_expr} <= {op2_expr})"
|
|
670
|
+
|
|
671
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
672
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
673
|
+
PyLegendBinaryExpression.__init__(
|
|
674
|
+
self,
|
|
675
|
+
operand1,
|
|
676
|
+
operand2,
|
|
677
|
+
PyLegendDateLessThanEqualExpression.__to_sql_func,
|
|
678
|
+
PyLegendDateLessThanEqualExpression.__to_pure_func
|
|
679
|
+
)
|
|
680
|
+
|
|
681
|
+
def is_non_nullable(self) -> bool:
|
|
682
|
+
return True
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
class PyLegendDateGreaterThanExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
686
|
+
|
|
687
|
+
@staticmethod
|
|
688
|
+
def __to_sql_func(
|
|
689
|
+
expression1: Expression,
|
|
690
|
+
expression2: Expression,
|
|
691
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
692
|
+
config: FrameToSqlConfig
|
|
693
|
+
) -> Expression:
|
|
694
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN)
|
|
695
|
+
|
|
696
|
+
@staticmethod
|
|
697
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
698
|
+
return f"({op1_expr} > {op2_expr})"
|
|
699
|
+
|
|
700
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
701
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
702
|
+
PyLegendBinaryExpression.__init__(
|
|
703
|
+
self,
|
|
704
|
+
operand1,
|
|
705
|
+
operand2,
|
|
706
|
+
PyLegendDateGreaterThanExpression.__to_sql_func,
|
|
707
|
+
PyLegendDateGreaterThanExpression.__to_pure_func
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
def is_non_nullable(self) -> bool:
|
|
711
|
+
return True
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
class PyLegendDateGreaterThanEqualExpression(PyLegendBinaryExpression, PyLegendExpressionBooleanReturn):
|
|
715
|
+
|
|
716
|
+
@staticmethod
|
|
717
|
+
def __to_sql_func(
|
|
718
|
+
expression1: Expression,
|
|
719
|
+
expression2: Expression,
|
|
720
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
721
|
+
config: FrameToSqlConfig
|
|
722
|
+
) -> Expression:
|
|
723
|
+
return ComparisonExpression(expression1, expression2, ComparisonOperator.GREATER_THAN_OR_EQUAL)
|
|
724
|
+
|
|
725
|
+
@staticmethod
|
|
726
|
+
def __to_pure_func(op1_expr: str, op2_expr: str, config: FrameToPureConfig) -> str:
|
|
727
|
+
return f"({op1_expr} >= {op2_expr})"
|
|
728
|
+
|
|
729
|
+
def __init__(self, operand1: PyLegendExpressionDateReturn, operand2: PyLegendExpressionDateReturn) -> None:
|
|
730
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
731
|
+
PyLegendBinaryExpression.__init__(
|
|
732
|
+
self,
|
|
733
|
+
operand1,
|
|
734
|
+
operand2,
|
|
735
|
+
PyLegendDateGreaterThanEqualExpression.__to_sql_func,
|
|
736
|
+
PyLegendDateGreaterThanEqualExpression.__to_pure_func
|
|
737
|
+
)
|
|
738
|
+
|
|
739
|
+
def is_non_nullable(self) -> bool:
|
|
740
|
+
return True
|
|
@@ -20,12 +20,16 @@ from pylegend.core.language.shared.expression import (
|
|
|
20
20
|
PyLegendExpression,
|
|
21
21
|
PyLegendExpressionBooleanReturn,
|
|
22
22
|
)
|
|
23
|
+
from pylegend.core.language.shared.helpers import generate_pure_functional_call
|
|
23
24
|
from pylegend.core.language.shared.operations.binary_expression import PyLegendBinaryExpression
|
|
25
|
+
from pylegend.core.language.shared.operations.unary_expression import PyLegendUnaryExpression
|
|
24
26
|
from pylegend.core.sql.metamodel import (
|
|
25
27
|
Expression,
|
|
26
28
|
QuerySpecification,
|
|
27
29
|
ComparisonExpression,
|
|
28
30
|
ComparisonOperator,
|
|
31
|
+
IsNullPredicate,
|
|
32
|
+
IsNotNullPredicate,
|
|
29
33
|
)
|
|
30
34
|
from pylegend.core.tds.tds_frame import FrameToSqlConfig
|
|
31
35
|
from pylegend.core.tds.tds_frame import FrameToPureConfig
|
|
@@ -34,6 +38,8 @@ from pylegend.core.tds.tds_frame import FrameToPureConfig
|
|
|
34
38
|
__all__: PyLegendSequence[str] = [
|
|
35
39
|
"PyLegendPrimitiveEqualsExpression",
|
|
36
40
|
"PyLegendPrimitiveNotEqualsExpression",
|
|
41
|
+
"PyLegendIsEmptyExpression",
|
|
42
|
+
"PyLegendIsNotEmptyExpression",
|
|
37
43
|
]
|
|
38
44
|
|
|
39
45
|
|
|
@@ -93,3 +99,57 @@ class PyLegendPrimitiveNotEqualsExpression(PyLegendBinaryExpression, PyLegendExp
|
|
|
93
99
|
|
|
94
100
|
def is_non_nullable(self) -> bool:
|
|
95
101
|
return True
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class PyLegendIsEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBooleanReturn):
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
def __to_sql_func(
|
|
108
|
+
expression: Expression,
|
|
109
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
110
|
+
config: FrameToSqlConfig
|
|
111
|
+
) -> Expression:
|
|
112
|
+
return IsNullPredicate(expression)
|
|
113
|
+
|
|
114
|
+
@staticmethod
|
|
115
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
116
|
+
return generate_pure_functional_call("isEmpty", [op_expr])
|
|
117
|
+
|
|
118
|
+
def __init__(self, operand: PyLegendExpression) -> None:
|
|
119
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
120
|
+
PyLegendUnaryExpression.__init__(
|
|
121
|
+
self,
|
|
122
|
+
operand,
|
|
123
|
+
PyLegendIsEmptyExpression.__to_sql_func,
|
|
124
|
+
PyLegendIsEmptyExpression.__to_pure_func
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
def is_non_nullable(self) -> bool:
|
|
128
|
+
return True
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class PyLegendIsNotEmptyExpression(PyLegendUnaryExpression, PyLegendExpressionBooleanReturn):
|
|
132
|
+
|
|
133
|
+
@staticmethod
|
|
134
|
+
def __to_sql_func(
|
|
135
|
+
expression: Expression,
|
|
136
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
137
|
+
config: FrameToSqlConfig
|
|
138
|
+
) -> Expression:
|
|
139
|
+
return IsNotNullPredicate(expression)
|
|
140
|
+
|
|
141
|
+
@staticmethod
|
|
142
|
+
def __to_pure_func(op_expr: str, config: FrameToPureConfig) -> str:
|
|
143
|
+
return generate_pure_functional_call("isNotEmpty", [op_expr])
|
|
144
|
+
|
|
145
|
+
def __init__(self, operand: PyLegendExpression) -> None:
|
|
146
|
+
PyLegendExpressionBooleanReturn.__init__(self)
|
|
147
|
+
PyLegendUnaryExpression.__init__(
|
|
148
|
+
self,
|
|
149
|
+
operand,
|
|
150
|
+
PyLegendIsNotEmptyExpression.__to_sql_func,
|
|
151
|
+
PyLegendIsNotEmptyExpression.__to_pure_func
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def is_non_nullable(self) -> bool:
|
|
155
|
+
return True
|
|
@@ -23,6 +23,7 @@ from pylegend.core.language.shared.expression import (
|
|
|
23
23
|
PyLegendExpressionBooleanReturn,
|
|
24
24
|
)
|
|
25
25
|
from pylegend.core.language.shared.operations.binary_expression import PyLegendBinaryExpression
|
|
26
|
+
from pylegend.core.language.shared.operations.nullary_expression import PyLegendNullaryExpression
|
|
26
27
|
from pylegend.core.language.shared.operations.unary_expression import PyLegendUnaryExpression
|
|
27
28
|
from pylegend.core.language.shared.helpers import generate_pure_functional_call
|
|
28
29
|
from pylegend.core.sql.metamodel import (
|
|
@@ -43,6 +44,7 @@ from pylegend.core.sql.metamodel_extension import (
|
|
|
43
44
|
StringTrimExpression,
|
|
44
45
|
StringPosExpression,
|
|
45
46
|
StringConcatExpression,
|
|
47
|
+
ConstantExpression,
|
|
46
48
|
)
|
|
47
49
|
from pylegend.core.tds.tds_frame import FrameToSqlConfig
|
|
48
50
|
from pylegend.core.tds.tds_frame import FrameToPureConfig
|
|
@@ -66,6 +68,7 @@ __all__: PyLegendSequence[str] = [
|
|
|
66
68
|
"PyLegendStringLessThanEqualExpression",
|
|
67
69
|
"PyLegendStringGreaterThanExpression",
|
|
68
70
|
"PyLegendStringGreaterThanEqualExpression",
|
|
71
|
+
"PyLegendCurrentUserExpression",
|
|
69
72
|
]
|
|
70
73
|
|
|
71
74
|
|
|
@@ -507,5 +510,27 @@ class PyLegendStringGreaterThanEqualExpression(PyLegendBinaryExpression, PyLegen
|
|
|
507
510
|
)
|
|
508
511
|
|
|
509
512
|
|
|
513
|
+
class PyLegendCurrentUserExpression(PyLegendNullaryExpression, PyLegendExpressionStringReturn):
|
|
514
|
+
|
|
515
|
+
@staticmethod
|
|
516
|
+
def __to_sql_func(
|
|
517
|
+
frame_name_to_base_query_map: PyLegendDict[str, QuerySpecification],
|
|
518
|
+
config: FrameToSqlConfig
|
|
519
|
+
) -> Expression:
|
|
520
|
+
return ConstantExpression('CURRENT_USER')
|
|
521
|
+
|
|
522
|
+
@staticmethod
|
|
523
|
+
def __to_pure_func(config: FrameToPureConfig) -> str:
|
|
524
|
+
return "currentUserId()"
|
|
525
|
+
|
|
526
|
+
def __init__(self) -> None:
|
|
527
|
+
PyLegendExpressionStringReturn.__init__(self)
|
|
528
|
+
PyLegendNullaryExpression.__init__(
|
|
529
|
+
self,
|
|
530
|
+
PyLegendCurrentUserExpression.__to_sql_func,
|
|
531
|
+
PyLegendCurrentUserExpression.__to_pure_func
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
|
|
510
535
|
def _escape_like_param(param: str) -> str:
|
|
511
536
|
return param.replace("_", "\\_").replace("%", "\\%")
|
|
@@ -21,6 +21,7 @@ from pylegend._typing import (
|
|
|
21
21
|
)
|
|
22
22
|
from pylegend.core.language.shared.primitives.primitive import PyLegendPrimitive
|
|
23
23
|
from pylegend.core.language.shared.primitives.integer import PyLegendInteger
|
|
24
|
+
from pylegend.core.language.shared.primitives.boolean import PyLegendBoolean
|
|
24
25
|
from pylegend.core.language.shared.expression import (
|
|
25
26
|
PyLegendExpressionDateReturn,
|
|
26
27
|
)
|
|
@@ -49,6 +50,10 @@ from pylegend.core.language.shared.operations.date_operation_expressions import
|
|
|
49
50
|
PyLegendSecondExpression,
|
|
50
51
|
PyLegendEpochExpression,
|
|
51
52
|
PyLegendDatePartExpression,
|
|
53
|
+
PyLegendDateLessThanExpression,
|
|
54
|
+
PyLegendDateLessThanEqualExpression,
|
|
55
|
+
PyLegendDateGreaterThanExpression,
|
|
56
|
+
PyLegendDateGreaterThanEqualExpression,
|
|
52
57
|
)
|
|
53
58
|
from pylegend.core.sql.metamodel import (
|
|
54
59
|
Expression,
|
|
@@ -153,6 +158,38 @@ class PyLegendDate(PyLegendPrimitive):
|
|
|
153
158
|
from pylegend.core.language.shared.primitives.strictdate import PyLegendStrictDate
|
|
154
159
|
return PyLegendStrictDate(PyLegendDatePartExpression(self.__value))
|
|
155
160
|
|
|
161
|
+
def __lt__(
|
|
162
|
+
self,
|
|
163
|
+
other: PyLegendUnion[date, datetime, "PyLegendStrictDate", "PyLegendDateTime", "PyLegendDate"]
|
|
164
|
+
) -> "PyLegendBoolean":
|
|
165
|
+
PyLegendDate.validate_param_to_be_date(other, "Date less than (<) parameter")
|
|
166
|
+
other_op = PyLegendDate.__convert_to_date_expr(other)
|
|
167
|
+
return PyLegendBoolean(PyLegendDateLessThanExpression(self.__value, other_op))
|
|
168
|
+
|
|
169
|
+
def __le__(
|
|
170
|
+
self,
|
|
171
|
+
other: PyLegendUnion[date, datetime, "PyLegendStrictDate", "PyLegendDateTime", "PyLegendDate"]
|
|
172
|
+
) -> "PyLegendBoolean":
|
|
173
|
+
PyLegendDate.validate_param_to_be_date(other, "Date less than equal (<=) parameter")
|
|
174
|
+
other_op = PyLegendDate.__convert_to_date_expr(other)
|
|
175
|
+
return PyLegendBoolean(PyLegendDateLessThanEqualExpression(self.__value, other_op))
|
|
176
|
+
|
|
177
|
+
def __gt__(
|
|
178
|
+
self,
|
|
179
|
+
other: PyLegendUnion[date, datetime, "PyLegendStrictDate", "PyLegendDateTime", "PyLegendDate"]
|
|
180
|
+
) -> "PyLegendBoolean":
|
|
181
|
+
PyLegendDate.validate_param_to_be_date(other, "Date greater than (>) parameter")
|
|
182
|
+
other_op = PyLegendDate.__convert_to_date_expr(other)
|
|
183
|
+
return PyLegendBoolean(PyLegendDateGreaterThanExpression(self.__value, other_op))
|
|
184
|
+
|
|
185
|
+
def __ge__(
|
|
186
|
+
self,
|
|
187
|
+
other: PyLegendUnion[date, datetime, "PyLegendStrictDate", "PyLegendDateTime", "PyLegendDate"]
|
|
188
|
+
) -> "PyLegendBoolean":
|
|
189
|
+
PyLegendDate.validate_param_to_be_date(other, "Date greater than equal (>=) parameter")
|
|
190
|
+
other_op = PyLegendDate.__convert_to_date_expr(other)
|
|
191
|
+
return PyLegendBoolean(PyLegendDateGreaterThanEqualExpression(self.__value, other_op))
|
|
192
|
+
|
|
156
193
|
@staticmethod
|
|
157
194
|
def __convert_to_date_expr(
|
|
158
195
|
val: PyLegendUnion[date, datetime, "PyLegendDateTime", "PyLegendStrictDate", "PyLegendDate"]
|
|
@@ -30,6 +30,8 @@ from pylegend.core.language.shared.literal_expressions import convert_literal_to
|
|
|
30
30
|
from pylegend.core.language.shared.operations.primitive_operation_expressions import (
|
|
31
31
|
PyLegendPrimitiveEqualsExpression,
|
|
32
32
|
PyLegendPrimitiveNotEqualsExpression,
|
|
33
|
+
PyLegendIsEmptyExpression,
|
|
34
|
+
PyLegendIsNotEmptyExpression,
|
|
33
35
|
)
|
|
34
36
|
from pylegend.core.tds.tds_frame import FrameToSqlConfig
|
|
35
37
|
from pylegend.core.tds.tds_frame import FrameToPureConfig
|
|
@@ -84,6 +86,20 @@ class PyLegendPrimitive(metaclass=ABCMeta):
|
|
|
84
86
|
from pylegend.core.language.shared.primitives.boolean import PyLegendBoolean
|
|
85
87
|
return PyLegendBoolean(PyLegendPrimitiveNotEqualsExpression(self.value(), other_op))
|
|
86
88
|
|
|
89
|
+
def is_empty(self) -> "PyLegendBoolean":
|
|
90
|
+
from pylegend.core.language.shared.primitives.boolean import PyLegendBoolean
|
|
91
|
+
return PyLegendBoolean(PyLegendIsEmptyExpression(self.value()))
|
|
92
|
+
|
|
93
|
+
def is_null(self) -> "PyLegendBoolean":
|
|
94
|
+
return self.is_empty()
|
|
95
|
+
|
|
96
|
+
def is_not_empty(self) -> "PyLegendBoolean":
|
|
97
|
+
from pylegend.core.language.shared.primitives.boolean import PyLegendBoolean
|
|
98
|
+
return PyLegendBoolean(PyLegendIsNotEmptyExpression(self.value()))
|
|
99
|
+
|
|
100
|
+
def is_not_null(self) -> "PyLegendBoolean":
|
|
101
|
+
return self.is_not_empty()
|
|
102
|
+
|
|
87
103
|
@staticmethod
|
|
88
104
|
def __validate_param_to_be_primitive(
|
|
89
105
|
param: "PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]",
|
|
@@ -80,6 +80,7 @@ __all__: PyLegendSequence[str] = [
|
|
|
80
80
|
"SecondExpression",
|
|
81
81
|
"EpochExpression",
|
|
82
82
|
"WindowExpression",
|
|
83
|
+
"ConstantExpression",
|
|
83
84
|
]
|
|
84
85
|
|
|
85
86
|
|
|
@@ -733,3 +734,14 @@ class WindowExpression(Expression):
|
|
|
733
734
|
super().__init__(_type="windowExpression")
|
|
734
735
|
self.nested = nested
|
|
735
736
|
self.window = window
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
class ConstantExpression(Expression):
|
|
740
|
+
name: str
|
|
741
|
+
|
|
742
|
+
def __init__(
|
|
743
|
+
self,
|
|
744
|
+
name: str
|
|
745
|
+
) -> None:
|
|
746
|
+
super().__init__(_type="constantExpression")
|
|
747
|
+
self.name = name
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
pylegend/__init__.py,sha256=
|
|
1
|
+
pylegend/__init__.py,sha256=gYOX0h2mTsQ_miZfuHosVzYR9O_IZjTP1FAum3naIW4,1668
|
|
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
|
|
5
5
|
pylegend/core/database/sql_to_string/__init__.py,sha256=_qWOoReR9ygprnShQRBtp4wFmqtiPEa88jAhOZpYY2c,1028
|
|
6
6
|
pylegend/core/database/sql_to_string/config.py,sha256=xrwPFcuZyzZcKNGeOQTnFW2y7CqhT6laSAazVl93JLU,1384
|
|
7
|
-
pylegend/core/database/sql_to_string/db_extension.py,sha256=
|
|
7
|
+
pylegend/core/database/sql_to_string/db_extension.py,sha256=dCSz9Sc4iXWsn3u9gaMAzyZsYa1ytQ8TeeAEHBWeGOE,52986
|
|
8
8
|
pylegend/core/database/sql_to_string/generator.py,sha256=xk3siXWyR7_ahn6pwsUMi80V_7NV2tYa7x5dosiNJR4,2607
|
|
9
|
-
pylegend/core/language/__init__.py,sha256=
|
|
9
|
+
pylegend/core/language/__init__.py,sha256=sw70dEA5RT660Qmpjxdi1XKEWDwshuedomqHhyIJpvI,4331
|
|
10
10
|
pylegend/core/language/legacy_api/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
11
11
|
pylegend/core/language/legacy_api/aggregate_specification.py,sha256=XT9kmlT3DqrJRUbQSju69ZW-23mORnJHE_Aplw_YpNw,2207
|
|
12
12
|
pylegend/core/language/legacy_api/legacy_api_tds_row.py,sha256=B3L55ylNVnHoukuETEyU7zPS5E_G9H8hSesGN48zgkM,1149
|
|
@@ -16,30 +16,30 @@ pylegend/core/language/legendql_api/legendql_api_tds_row.py,sha256=5hejBF2uYjXua
|
|
|
16
16
|
pylegend/core/language/shared/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
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
|
-
pylegend/core/language/shared/functions.py,sha256=
|
|
19
|
+
pylegend/core/language/shared/functions.py,sha256=G94EiFdZV4jorJTX23ErxKP1GusKl61G3qQN1e26Zws,1495
|
|
20
20
|
pylegend/core/language/shared/helpers.py,sha256=PKse5aunaf3OMeXG0kt39XljAtN60pDDDFZ-d43-UU0,2777
|
|
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
23
|
pylegend/core/language/shared/operations/binary_expression.py,sha256=zQuwPHUQzrhqOwSpajB2xososioCPVZYi-67DSaYBvg,4020
|
|
24
24
|
pylegend/core/language/shared/operations/boolean_operation_expressions.py,sha256=GQZp4xQttW-ayntXvyvnxhRIdcnuCFyUK7zsf8c5wJQ,4618
|
|
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=
|
|
26
|
+
pylegend/core/language/shared/operations/date_operation_expressions.py,sha256=q20u_NfcJFiE7GHhp0uxJzIqfwynCvVkJ5taPc45tKM,26503
|
|
27
27
|
pylegend/core/language/shared/operations/float_operation_expressions.py,sha256=XXZRgSUFLW0GLn6fMynQvFaHTxNJ5fln1UqpdhhDM18,6969
|
|
28
28
|
pylegend/core/language/shared/operations/integer_operation_expressions.py,sha256=UfxJJW3QOh-U1skZwXRIM2k2nvQTwjnT3FMrrI_a2qU,8302
|
|
29
29
|
pylegend/core/language/shared/operations/nullary_expression.py,sha256=svlZ5ejYqz843v3xkcImizcKia6RiWXXD_hA_QFT2wg,2083
|
|
30
30
|
pylegend/core/language/shared/operations/number_operation_expressions.py,sha256=BIayvrXqPjD5OQr7ttO0JgkV9zos6cCJ2OUZ5Vhq8SM,29700
|
|
31
|
-
pylegend/core/language/shared/operations/primitive_operation_expressions.py,sha256=
|
|
32
|
-
pylegend/core/language/shared/operations/string_operation_expressions.py,sha256=
|
|
31
|
+
pylegend/core/language/shared/operations/primitive_operation_expressions.py,sha256=4emM6WwCQtcgUucHW5xRR2r9pQMrDT5u7bz1U_AGqOs,5409
|
|
32
|
+
pylegend/core/language/shared/operations/string_operation_expressions.py,sha256=bkoV7mxLgZnrbKElXv-mfixqlktlp07CknhNK5R5zg8,20377
|
|
33
33
|
pylegend/core/language/shared/operations/unary_expression.py,sha256=tJCHacGspj-dkr4fepB8i9MntFMWqFVLBGORvhcly7U,2400
|
|
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
|
|
37
|
-
pylegend/core/language/shared/primitives/date.py,sha256=
|
|
37
|
+
pylegend/core/language/shared/primitives/date.py,sha256=CFiz6LquJIUHBIdHGZ5j16wYcw-Bo4nYHeM7Hne1EWI,9062
|
|
38
38
|
pylegend/core/language/shared/primitives/datetime.py,sha256=F8m-pLm_VcefI-_iF8CCjbi-AZKzrXxqyuXZtxJB_AU,2495
|
|
39
39
|
pylegend/core/language/shared/primitives/float.py,sha256=LpD3nWogv8aT6RECgI7rVmsRPY4ji96JCXdTEAr2EAg,6146
|
|
40
40
|
pylegend/core/language/shared/primitives/integer.py,sha256=dXccyccyR9UWlqTlTobTdl4PrSy7W9NPDnJKCVewJ9w,7334
|
|
41
41
|
pylegend/core/language/shared/primitives/number.py,sha256=bYqBFtsauUGijP1kqRuSYDSTIVokU0b-paFH3uZGQZU,13699
|
|
42
|
-
pylegend/core/language/shared/primitives/primitive.py,sha256=
|
|
42
|
+
pylegend/core/language/shared/primitives/primitive.py,sha256=RUirddeU8kMV-wqeo2Kju7eyisY6epddIUWxZXKuKmg,4486
|
|
43
43
|
pylegend/core/language/shared/primitives/strictdate.py,sha256=FidyUqdWTaOrk6tomYHQvhfnGW--zVTt9ldIgGxJk5M,2503
|
|
44
44
|
pylegend/core/language/shared/primitives/string.py,sha256=qjiKaR5wioL8tz55BnTENtKlOGP4d1G0cVP-WhYMNrs,8282
|
|
45
45
|
pylegend/core/language/shared/tds_row.py,sha256=23sxVfa74T-TlfAs1CgvwjhV26b-FyZ72yGy9BqP7CE,9027
|
|
@@ -51,7 +51,7 @@ pylegend/core/request/response_reader.py,sha256=TNMi2GKk4lkmf7VMeY5n2AwhxxuWbX4M
|
|
|
51
51
|
pylegend/core/request/service_client.py,sha256=oNvMR6qNl5UcxpcAjIb4CCpd0MB3Z-Y5OJSyFPGeerM,3377
|
|
52
52
|
pylegend/core/sql/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
53
53
|
pylegend/core/sql/metamodel.py,sha256=B7aqblDyyiTsqWZUW2Is9_2FHTsYTkvhJ1FVxXxoSF8,20134
|
|
54
|
-
pylegend/core/sql/metamodel_extension.py,sha256=
|
|
54
|
+
pylegend/core/sql/metamodel_extension.py,sha256=B53DUH4nXPWqMmbcfmLAHvJHX370J0Ml_eYdJzASbJE,15905
|
|
55
55
|
pylegend/core/tds/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
56
56
|
pylegend/core/tds/abstract/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
57
57
|
pylegend/core/tds/abstract/frames/__init__.py,sha256=g6w4WCuQ2pqQG6yyn-QLLXED3ttOOB8YnXzVt3ijb28,578
|
|
@@ -147,9 +147,9 @@ pylegend/extensions/tds/result_handler/to_pandas_df_result_handler.py,sha256=tvV
|
|
|
147
147
|
pylegend/legacy_api_tds_client.py,sha256=IXfo2pdBFV3M3S4RYKJcvudMc_OGdR0yvJhTV-ovI3s,2319
|
|
148
148
|
pylegend/utils/__init__.py,sha256=LXTDJSDmHQXtnMDZouhZp9IZQVpY6ONkINbUYjtnMkE,578
|
|
149
149
|
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.
|
|
150
|
+
pylegend-0.5.0.dist-info/LICENSE,sha256=AGR96_qQPZO66Gjqq4G6r_g670K35VtW-IobTAkmZJM,11343
|
|
151
|
+
pylegend-0.5.0.dist-info/LICENSE.spdx,sha256=i7TsBclLotUvMjx9vZ_6S8Pp0r4uknWGw1RwiKBBvQ4,207
|
|
152
|
+
pylegend-0.5.0.dist-info/METADATA,sha256=ggohQnjEXzNQyJsn8l54276zCqQOl8yx8VK9Fif7nTs,4210
|
|
153
|
+
pylegend-0.5.0.dist-info/NOTICE,sha256=2Lr4FqiscyRI7-vyn7c2z-zqUw2p6x7upJyBvFKkHjk,167
|
|
154
|
+
pylegend-0.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
155
|
+
pylegend-0.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|