pylegend 0.2.2__py3-none-any.whl → 0.4.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.
Files changed (123) hide show
  1. pylegend/__init__.py +9 -5
  2. pylegend/core/{databse → database}/sql_to_string/__init__.py +3 -3
  3. pylegend/core/{databse → database}/sql_to_string/db_extension.py +11 -5
  4. pylegend/core/{databse → database}/sql_to_string/generator.py +2 -2
  5. pylegend/core/language/__init__.py +10 -10
  6. pylegend/core/language/legacy_api/__init__.py +13 -0
  7. pylegend/core/language/{aggregate_specification.py → legacy_api/aggregate_specification.py} +10 -10
  8. pylegend/core/language/legacy_api/legacy_api_tds_row.py +32 -0
  9. pylegend/core/language/legendql_api/__init__.py +13 -0
  10. pylegend/core/language/legendql_api/legendql_api_custom_expressions.py +541 -0
  11. pylegend/core/language/legendql_api/legendql_api_tds_row.py +292 -0
  12. pylegend/core/language/shared/__init__.py +13 -0
  13. pylegend/core/language/{column_expressions.py → shared/column_expressions.py} +32 -31
  14. pylegend/core/language/{expression.py → shared/expression.py} +8 -0
  15. pylegend/core/language/{functions.py → shared/functions.py} +3 -3
  16. pylegend/core/language/shared/helpers.py +75 -0
  17. pylegend/core/language/{literal_expressions.py → shared/literal_expressions.py} +39 -1
  18. pylegend/core/language/{operations → shared/operations}/binary_expression.py +34 -2
  19. pylegend/core/language/{operations → shared/operations}/boolean_operation_expressions.py +34 -6
  20. pylegend/core/language/{operations → shared/operations}/collection_operation_expressions.py +146 -26
  21. pylegend/core/language/{operations → shared/operations}/date_operation_expressions.py +164 -24
  22. pylegend/core/language/{operations → shared/operations}/float_operation_expressions.py +53 -8
  23. pylegend/core/language/{operations → shared/operations}/integer_operation_expressions.py +62 -9
  24. pylegend/core/language/{operations → shared/operations}/nullary_expression.py +9 -2
  25. pylegend/core/language/{operations → shared/operations}/number_operation_expressions.py +211 -30
  26. pylegend/core/language/{operations → shared/operations}/primitive_operation_expressions.py +42 -3
  27. pylegend/core/language/{operations → shared/operations}/string_operation_expressions.py +169 -21
  28. pylegend/core/language/{operations → shared/operations}/unary_expression.py +10 -2
  29. pylegend/core/language/{primitive_collection.py → shared/primitive_collection.py} +2 -2
  30. pylegend/core/language/{primitives → shared/primitives}/__init__.py +9 -9
  31. pylegend/core/language/{primitives → shared/primitives}/boolean.py +9 -5
  32. pylegend/core/language/{primitives → shared/primitives}/date.py +23 -15
  33. pylegend/core/language/{primitives → shared/primitives}/datetime.py +4 -5
  34. pylegend/core/language/{primitives → shared/primitives}/float.py +6 -6
  35. pylegend/core/language/{primitives → shared/primitives}/integer.py +6 -6
  36. pylegend/core/language/{primitives → shared/primitives}/number.py +16 -13
  37. pylegend/core/language/{primitives → shared/primitives}/primitive.py +25 -5
  38. pylegend/core/language/{primitives → shared/primitives}/strictdate.py +4 -5
  39. pylegend/core/language/{primitives → shared/primitives}/string.py +18 -19
  40. pylegend/core/language/{tds_row.py → shared/tds_row.py} +46 -16
  41. pylegend/core/request/__init__.py +8 -1
  42. pylegend/core/request/auth.py +89 -11
  43. pylegend/core/request/legend_client.py +32 -0
  44. pylegend/core/sql/metamodel_extension.py +16 -0
  45. pylegend/core/tds/abstract/__init__.py +13 -0
  46. pylegend/core/tds/abstract/frames/__init__.py +13 -0
  47. pylegend/core/tds/{legend_api/frames/legend_api_applied_function_tds_frame.py → abstract/frames/applied_function_tds_frame.py} +19 -13
  48. pylegend/core/tds/abstract/frames/base_tds_frame.py +125 -0
  49. pylegend/core/tds/{legend_api/frames/legend_api_input_tds_frame.py → abstract/frames/input_tds_frame.py} +9 -12
  50. pylegend/core/tds/{legend_api/frames/functions → abstract}/function_helpers.py +1 -1
  51. pylegend/core/tds/{legend_api/frames/functions/concatenate_function.py → legacy_api/frames/functions/legacy_api_concatenate_function.py} +25 -13
  52. pylegend/core/tds/{legend_api/frames/functions/distinct_function.py → legacy_api/frames/functions/legacy_api_distinct_function.py} +13 -8
  53. pylegend/core/tds/{legend_api/frames/functions/drop_function.py → legacy_api/frames/functions/legacy_api_drop_function.py} +13 -8
  54. pylegend/core/tds/{legend_api/frames/functions/extend_function.py → legacy_api/frames/functions/legacy_api_extend_function.py} +36 -16
  55. pylegend/core/tds/{legend_api/frames/functions/filter_function.py → legacy_api/frames/functions/legacy_api_filter_function.py} +25 -13
  56. pylegend/core/tds/{legend_api/frames/functions/group_by_function.py → legacy_api/frames/functions/legacy_api_group_by_function.py} +44 -17
  57. pylegend/core/tds/{legend_api/frames/functions/head_function.py → legacy_api/frames/functions/legacy_api_head_function.py} +13 -8
  58. pylegend/core/tds/{legend_api/frames/functions/join_by_columns_function.py → legacy_api/frames/functions/legacy_api_join_by_columns_function.py} +40 -13
  59. pylegend/core/tds/{legend_api/frames/functions/join_function.py → legacy_api/frames/functions/legacy_api_join_function.py} +44 -20
  60. pylegend/core/tds/{legend_api/frames/functions/rename_columns_function.py → legacy_api/frames/functions/legacy_api_rename_columns_function.py} +20 -8
  61. pylegend/core/tds/{legend_api/frames/functions/restrict_function.py → legacy_api/frames/functions/legacy_api_restrict_function.py} +17 -8
  62. pylegend/core/tds/{legend_api/frames/functions/slice_function.py → legacy_api/frames/functions/legacy_api_slice_function.py} +13 -8
  63. pylegend/core/tds/{legend_api/frames/functions/sort_function.py → legacy_api/frames/functions/legacy_api_sort_function.py} +19 -8
  64. pylegend/core/tds/legacy_api/frames/legacy_api_applied_function_tds_frame.py +37 -0
  65. pylegend/core/tds/legacy_api/frames/legacy_api_base_tds_frame.py +204 -0
  66. pylegend/core/tds/legacy_api/frames/legacy_api_input_tds_frame.py +51 -0
  67. pylegend/core/tds/{legend_api/frames/legend_api_tds_frame.py → legacy_api/frames/legacy_api_tds_frame.py} +28 -28
  68. pylegend/core/tds/legendql_api/__init__.py +13 -0
  69. pylegend/core/tds/legendql_api/frames/__init__.py +13 -0
  70. pylegend/core/tds/legendql_api/frames/functions/__init__.py +13 -0
  71. pylegend/core/tds/legendql_api/frames/functions/legendql_api_asofjoin_function.py +156 -0
  72. pylegend/core/tds/legendql_api/frames/functions/legendql_api_concatenate_function.py +139 -0
  73. pylegend/core/tds/legendql_api/frames/functions/legendql_api_distinct_function.py +69 -0
  74. pylegend/core/tds/legendql_api/frames/functions/legendql_api_drop_function.py +74 -0
  75. pylegend/core/tds/legendql_api/frames/functions/legendql_api_extend_function.py +256 -0
  76. pylegend/core/tds/legendql_api/frames/functions/legendql_api_filter_function.py +121 -0
  77. pylegend/core/tds/legendql_api/frames/functions/legendql_api_function_helpers.py +137 -0
  78. pylegend/core/tds/legendql_api/frames/functions/legendql_api_groupby_function.py +256 -0
  79. pylegend/core/tds/legendql_api/frames/functions/legendql_api_head_function.py +74 -0
  80. pylegend/core/tds/legendql_api/frames/functions/legendql_api_join_function.py +214 -0
  81. pylegend/core/tds/legendql_api/frames/functions/legendql_api_project_function.py +169 -0
  82. pylegend/core/tds/legendql_api/frames/functions/legendql_api_rename_function.py +189 -0
  83. pylegend/core/tds/legendql_api/frames/functions/legendql_api_select_function.py +131 -0
  84. pylegend/core/tds/legendql_api/frames/functions/legendql_api_slice_function.py +82 -0
  85. pylegend/core/tds/legendql_api/frames/functions/legendql_api_sort_function.py +93 -0
  86. pylegend/core/tds/legendql_api/frames/functions/legendql_api_window_extend_function.py +283 -0
  87. pylegend/core/tds/legendql_api/frames/legendql_api_applied_function_tds_frame.py +37 -0
  88. pylegend/core/tds/legendql_api/frames/legendql_api_base_tds_frame.py +419 -0
  89. pylegend/core/tds/legendql_api/frames/legendql_api_input_tds_frame.py +50 -0
  90. pylegend/core/tds/legendql_api/frames/legendql_api_tds_frame.py +327 -0
  91. pylegend/core/tds/pandas_api/frames/functions/assign_function.py +6 -6
  92. pylegend/core/tds/pandas_api/frames/pandas_api_applied_function_tds_frame.py +4 -0
  93. pylegend/core/tds/pandas_api/frames/pandas_api_base_tds_frame.py +11 -3
  94. pylegend/core/tds/pandas_api/frames/pandas_api_tds_frame.py +2 -2
  95. pylegend/core/tds/tds_frame.py +32 -2
  96. pylegend/extensions/database/vendors/postgres/postgres_sql_to_string.py +1 -1
  97. pylegend/extensions/tds/abstract/legend_function_input_frame.py +4 -0
  98. pylegend/extensions/tds/abstract/legend_service_input_frame.py +4 -0
  99. pylegend/extensions/tds/abstract/table_spec_input_frame.py +4 -0
  100. pylegend/extensions/tds/{legend_api/frames/legend_api_legend_function_input_frame.py → legacy_api/frames/legacy_api_legend_function_input_frame.py} +5 -5
  101. pylegend/extensions/tds/{legend_api/frames/legend_api_legend_service_input_frame.py → legacy_api/frames/legacy_api_legend_service_input_frame.py} +6 -6
  102. pylegend/extensions/tds/{legend_api/frames/legend_api_table_spec_input_frame.py → legacy_api/frames/legacy_api_table_spec_input_frame.py} +5 -5
  103. pylegend/extensions/tds/legendql_api/__init__.py +13 -0
  104. pylegend/extensions/tds/legendql_api/frames/__init__.py +13 -0
  105. pylegend/extensions/tds/legendql_api/frames/legendql_api_legend_service_input_frame.py +46 -0
  106. pylegend/extensions/tds/legendql_api/frames/legendql_api_table_spec_input_frame.py +36 -0
  107. pylegend/{legend_api_tds_client.py → legacy_api_tds_client.py} +15 -15
  108. {pylegend-0.2.2.dist-info → pylegend-0.4.0.dist-info}/METADATA +7 -8
  109. pylegend-0.4.0.dist-info/NOTICE +5 -0
  110. pylegend-0.4.0.dist-info/RECORD +155 -0
  111. {pylegend-0.2.2.dist-info → pylegend-0.4.0.dist-info}/WHEEL +1 -1
  112. pylegend/core/tds/legend_api/frames/legend_api_base_tds_frame.py +0 -294
  113. pylegend-0.2.2.dist-info/RECORD +0 -115
  114. /pylegend/core/{databse → database}/__init__.py +0 -0
  115. /pylegend/core/{databse → database}/sql_to_string/config.py +0 -0
  116. /pylegend/core/language/{operations → shared/operations}/__init__.py +0 -0
  117. /pylegend/core/tds/{legend_api → legacy_api}/__init__.py +0 -0
  118. /pylegend/core/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
  119. /pylegend/core/tds/{legend_api → legacy_api}/frames/functions/__init__.py +0 -0
  120. /pylegend/extensions/tds/{legend_api → legacy_api}/__init__.py +0 -0
  121. /pylegend/extensions/tds/{legend_api → legacy_api}/frames/__init__.py +0 -0
  122. {pylegend-0.2.2.dist-info → pylegend-0.4.0.dist-info}/LICENSE +0 -0
  123. {pylegend-0.2.2.dist-info → pylegend-0.4.0.dist-info}/LICENSE.spdx +0 -0
@@ -0,0 +1,327 @@
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 abc import ABCMeta, abstractmethod
16
+
17
+ from pylegend.core.language import PyLegendBoolean, PyLegendPrimitiveOrPythonPrimitive, PyLegendPrimitiveCollection, \
18
+ PyLegendPrimitive
19
+ from pylegend.core.language.legendql_api.legendql_api_custom_expressions import (
20
+ LegendQLApiPrimitive,
21
+ LegendQLApiSortInfo,
22
+ LegendQLApiWindow,
23
+ LegendQLApiPartialFrame,
24
+ LegendQLApiWindowReference,
25
+ )
26
+ from pylegend.core.language.legendql_api.legendql_api_tds_row import LegendQLApiTdsRow
27
+ from pylegend.core.tds.tds_frame import (
28
+ PyLegendTdsFrame
29
+ )
30
+ from pylegend._typing import (
31
+ PyLegendSequence,
32
+ PyLegendCallable,
33
+ PyLegendUnion,
34
+ PyLegendList,
35
+ PyLegendOptional,
36
+ PyLegendTuple,
37
+ )
38
+
39
+ __all__: PyLegendSequence[str] = [
40
+ "LegendQLApiTdsFrame"
41
+ ]
42
+
43
+
44
+ class LegendQLApiTdsFrame(PyLegendTdsFrame, metaclass=ABCMeta):
45
+
46
+ @abstractmethod
47
+ def head(self, count: int = 5) -> "LegendQLApiTdsFrame":
48
+ pass # pragma: no cover
49
+
50
+ @abstractmethod
51
+ def limit(self, count: int = 5) -> "LegendQLApiTdsFrame":
52
+ pass # pragma: no cover
53
+
54
+ @abstractmethod
55
+ def drop(self, count: int = 5) -> "LegendQLApiTdsFrame":
56
+ pass # pragma: no cover
57
+
58
+ @abstractmethod
59
+ def slice(self, start_row: int, end_row_exclusive: int) -> "LegendQLApiTdsFrame":
60
+ pass # pragma: no cover
61
+
62
+ @abstractmethod
63
+ def distinct(self) -> "LegendQLApiTdsFrame":
64
+ pass # pragma: no cover
65
+
66
+ @abstractmethod
67
+ def select(
68
+ self,
69
+ columns: PyLegendUnion[
70
+ str,
71
+ PyLegendList[str],
72
+ PyLegendCallable[
73
+ [LegendQLApiTdsRow],
74
+ PyLegendUnion[LegendQLApiPrimitive, PyLegendList[LegendQLApiPrimitive]]
75
+ ]
76
+ ]
77
+ ) -> "LegendQLApiTdsFrame":
78
+ pass # pragma: no cover
79
+
80
+ @abstractmethod
81
+ def sort(
82
+ self,
83
+ sort_infos: PyLegendUnion[
84
+ str,
85
+ PyLegendList[str],
86
+ PyLegendCallable[
87
+ [LegendQLApiTdsRow],
88
+ PyLegendUnion[
89
+ LegendQLApiPrimitive,
90
+ LegendQLApiSortInfo,
91
+ PyLegendList[PyLegendUnion[LegendQLApiPrimitive, LegendQLApiSortInfo]],
92
+ ]
93
+ ]
94
+ ]
95
+ ) -> "LegendQLApiTdsFrame":
96
+ pass # pragma: no cover
97
+
98
+ @abstractmethod
99
+ def concatenate(self, other: "LegendQLApiTdsFrame") -> "LegendQLApiTdsFrame":
100
+ pass # pragma: no cover
101
+
102
+ @abstractmethod
103
+ def filter(
104
+ self,
105
+ filter_function: PyLegendCallable[[LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]]
106
+ ) -> "LegendQLApiTdsFrame":
107
+ pass # pragma: no cover
108
+
109
+ @abstractmethod
110
+ def rename(
111
+ self,
112
+ column_renames: PyLegendUnion[
113
+ PyLegendTuple[str, str],
114
+ PyLegendList[PyLegendTuple[str, str]],
115
+ PyLegendCallable[
116
+ [LegendQLApiTdsRow],
117
+ PyLegendUnion[
118
+ PyLegendTuple[LegendQLApiPrimitive, str],
119
+ PyLegendList[PyLegendTuple[LegendQLApiPrimitive, str]]
120
+ ]
121
+ ]
122
+ ]
123
+ ) -> "LegendQLApiTdsFrame":
124
+ pass # pragma: no cover
125
+
126
+ @abstractmethod
127
+ def extend(
128
+ self,
129
+ extend_columns: PyLegendUnion[
130
+ PyLegendTuple[
131
+ str,
132
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]
133
+ ],
134
+ PyLegendTuple[
135
+ str,
136
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
137
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
138
+ ],
139
+ PyLegendList[
140
+ PyLegendUnion[
141
+ PyLegendTuple[
142
+ str,
143
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]
144
+ ],
145
+ PyLegendTuple[
146
+ str,
147
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
148
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
149
+ ]
150
+ ]
151
+ ]
152
+ ]
153
+ ) -> "LegendQLApiTdsFrame":
154
+ pass # pragma: no cover
155
+
156
+ @abstractmethod
157
+ def join(
158
+ self,
159
+ other: "LegendQLApiTdsFrame",
160
+ join_condition: PyLegendCallable[
161
+ [LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]
162
+ ],
163
+ join_type: str = 'LEFT_OUTER'
164
+ ) -> "LegendQLApiTdsFrame":
165
+ pass # pragma: no cover
166
+
167
+ @abstractmethod
168
+ def inner_join(
169
+ self,
170
+ other: "LegendQLApiTdsFrame",
171
+ join_condition: PyLegendCallable[
172
+ [LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]
173
+ ]
174
+ ) -> "LegendQLApiTdsFrame":
175
+ pass # pragma: no cover
176
+
177
+ @abstractmethod
178
+ def left_join(
179
+ self,
180
+ other: "LegendQLApiTdsFrame",
181
+ join_condition: PyLegendCallable[
182
+ [LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]
183
+ ]
184
+ ) -> "LegendQLApiTdsFrame":
185
+ pass # pragma: no cover
186
+
187
+ @abstractmethod
188
+ def right_join(
189
+ self,
190
+ other: "LegendQLApiTdsFrame",
191
+ join_condition: PyLegendCallable[
192
+ [LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]
193
+ ]
194
+ ) -> "LegendQLApiTdsFrame":
195
+ pass # pragma: no cover
196
+
197
+ @abstractmethod
198
+ def as_of_join(
199
+ self,
200
+ other: "LegendQLApiTdsFrame",
201
+ match_function: PyLegendCallable[
202
+ [LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]
203
+ ],
204
+ join_condition: PyLegendOptional[
205
+ PyLegendCallable[[LegendQLApiTdsRow, LegendQLApiTdsRow], PyLegendUnion[bool, PyLegendBoolean]]
206
+ ] = None
207
+ ) -> "LegendQLApiTdsFrame":
208
+ pass # pragma: no cover
209
+
210
+ @abstractmethod
211
+ def group_by(
212
+ self,
213
+ grouping_columns: PyLegendUnion[
214
+ str,
215
+ PyLegendList[str],
216
+ PyLegendCallable[
217
+ [LegendQLApiTdsRow],
218
+ PyLegendUnion[LegendQLApiPrimitive, PyLegendList[LegendQLApiPrimitive]]
219
+ ]
220
+ ],
221
+ aggregate_specifications: PyLegendUnion[
222
+ PyLegendTuple[
223
+ str,
224
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
225
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
226
+ ],
227
+ PyLegendList[
228
+ PyLegendTuple[
229
+ str,
230
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive],
231
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
232
+ ]
233
+ ]
234
+ ]
235
+ ) -> "LegendQLApiTdsFrame":
236
+ pass # pragma: no cover
237
+
238
+ @abstractmethod
239
+ def window(
240
+ self,
241
+ partition_by: PyLegendOptional[
242
+ PyLegendUnion[
243
+ str,
244
+ PyLegendList[str],
245
+ PyLegendCallable[
246
+ [LegendQLApiTdsRow],
247
+ PyLegendUnion[LegendQLApiPrimitive, PyLegendList[LegendQLApiPrimitive]]
248
+ ]
249
+ ]
250
+ ] = None,
251
+ order_by: PyLegendOptional[
252
+ PyLegendUnion[
253
+ str,
254
+ PyLegendList[str],
255
+ PyLegendCallable[
256
+ [LegendQLApiTdsRow],
257
+ PyLegendUnion[
258
+ LegendQLApiPrimitive,
259
+ LegendQLApiSortInfo,
260
+ PyLegendList[PyLegendUnion[LegendQLApiPrimitive, LegendQLApiSortInfo]],
261
+ ]
262
+ ]
263
+ ]
264
+ ] = None
265
+ ) -> LegendQLApiWindow:
266
+ pass
267
+
268
+ @abstractmethod
269
+ def window_extend(
270
+ self,
271
+ window: LegendQLApiWindow,
272
+ extend_columns: PyLegendUnion[
273
+ PyLegendTuple[
274
+ str,
275
+ PyLegendCallable[
276
+ [LegendQLApiPartialFrame, LegendQLApiWindowReference, LegendQLApiTdsRow],
277
+ PyLegendPrimitiveOrPythonPrimitive
278
+ ]
279
+ ],
280
+ PyLegendTuple[
281
+ str,
282
+ PyLegendCallable[
283
+ [LegendQLApiPartialFrame, LegendQLApiWindowReference, LegendQLApiTdsRow],
284
+ PyLegendPrimitiveOrPythonPrimitive
285
+ ],
286
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
287
+ ],
288
+ PyLegendList[
289
+ PyLegendUnion[
290
+ PyLegendTuple[
291
+ str,
292
+ PyLegendCallable[
293
+ [LegendQLApiPartialFrame, LegendQLApiWindowReference, LegendQLApiTdsRow],
294
+ PyLegendPrimitiveOrPythonPrimitive
295
+ ]
296
+ ],
297
+ PyLegendTuple[
298
+ str,
299
+ PyLegendCallable[
300
+ [LegendQLApiPartialFrame, LegendQLApiWindowReference, LegendQLApiTdsRow],
301
+ PyLegendPrimitiveOrPythonPrimitive
302
+ ],
303
+ PyLegendCallable[[PyLegendPrimitiveCollection], PyLegendPrimitive]
304
+ ]
305
+ ]
306
+ ]
307
+ ]
308
+ ) -> "LegendQLApiTdsFrame":
309
+ pass
310
+
311
+ @abstractmethod
312
+ def project(
313
+ self,
314
+ project_columns: PyLegendUnion[
315
+ PyLegendTuple[
316
+ str,
317
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]
318
+ ],
319
+ PyLegendList[
320
+ PyLegendTuple[
321
+ str,
322
+ PyLegendCallable[[LegendQLApiTdsRow], PyLegendPrimitiveOrPythonPrimitive]
323
+ ]
324
+ ]
325
+ ]
326
+ ) -> "LegendQLApiTdsFrame":
327
+ pass # pragma: no cover
@@ -30,7 +30,7 @@ from pylegend.core.tds.pandas_api.frames.pandas_api_base_tds_frame import Pandas
30
30
  from pylegend.core.tds.tds_column import TdsColumn, PrimitiveTdsColumn
31
31
  from pylegend.core.tds.tds_frame import FrameToSqlConfig
32
32
  from pylegend.core.language import (
33
- TdsRow,
33
+ LegacyApiTdsRow,
34
34
  PyLegendPrimitive,
35
35
  PyLegendInteger,
36
36
  PyLegendFloat,
@@ -44,7 +44,7 @@ class AssignFunction(PandasApiAppliedFunction):
44
44
  __base_frame: PandasApiBaseTdsFrame
45
45
  __col_definitions: PyLegendDict[
46
46
  str,
47
- PyLegendCallable[[TdsRow], PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]],
47
+ PyLegendCallable[[LegacyApiTdsRow], PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]],
48
48
  ]
49
49
 
50
50
  @classmethod
@@ -56,7 +56,7 @@ class AssignFunction(PandasApiAppliedFunction):
56
56
  base_frame: PandasApiBaseTdsFrame,
57
57
  col_definitions: PyLegendDict[
58
58
  str,
59
- PyLegendCallable[[TdsRow], PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]],
59
+ PyLegendCallable[[LegacyApiTdsRow], PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]],
60
60
  ]
61
61
  ) -> None:
62
62
  self.__base_frame = base_frame
@@ -72,7 +72,7 @@ class AssignFunction(PandasApiAppliedFunction):
72
72
  copy_query(base_query)
73
73
  )
74
74
 
75
- tds_row = TdsRow.from_tds_frame("frame", self.__base_frame)
75
+ tds_row = LegacyApiTdsRow.from_tds_frame("frame", self.__base_frame)
76
76
  for col, func in self.__col_definitions.items():
77
77
  res = func(tds_row)
78
78
  if not isinstance(res, PyLegendPrimitive):
@@ -94,7 +94,7 @@ class AssignFunction(PandasApiAppliedFunction):
94
94
 
95
95
  def calculate_columns(self) -> PyLegendSequence["TdsColumn"]:
96
96
  new_cols = [c.copy() for c in self.__base_frame.columns()]
97
- tds_row = TdsRow.from_tds_frame("frame", self.__base_frame)
97
+ tds_row = LegacyApiTdsRow.from_tds_frame("frame", self.__base_frame)
98
98
  for col, func in self.__col_definitions.items():
99
99
  res = func(tds_row)
100
100
  if isinstance(res, (int, PyLegendInteger)):
@@ -112,7 +112,7 @@ class AssignFunction(PandasApiAppliedFunction):
112
112
  return new_cols
113
113
 
114
114
  def validate(self) -> bool:
115
- tds_row = TdsRow.from_tds_frame("frame", self.__base_frame)
115
+ tds_row = LegacyApiTdsRow.from_tds_frame("frame", self.__base_frame)
116
116
  for col, f in self.__col_definitions.items():
117
117
  f(tds_row)
118
118
  return True
@@ -20,6 +20,7 @@ from pylegend._typing import (
20
20
  from pylegend.core.sql.metamodel import QuerySpecification
21
21
  from pylegend.core.tds.tds_column import TdsColumn
22
22
  from pylegend.core.tds.tds_frame import FrameToSqlConfig
23
+ from pylegend.core.tds.tds_frame import FrameToPureConfig
23
24
  from pylegend.core.tds.pandas_api.frames.pandas_api_base_tds_frame import PandasApiBaseTdsFrame
24
25
 
25
26
 
@@ -67,6 +68,9 @@ class PandasApiAppliedFunctionTdsFrame(PandasApiBaseTdsFrame):
67
68
  def to_sql_query_object(self, config: FrameToSqlConfig) -> QuerySpecification:
68
69
  return self.__applied_function.to_sql(config)
69
70
 
71
+ def to_pure(self, config: FrameToPureConfig) -> str:
72
+ raise RuntimeError("to_pure is not supported for PandasApiAppliedFunctionTdsFrame")
73
+
70
74
  def get_all_tds_frames(self) -> PyLegendList["PandasApiBaseTdsFrame"]:
71
75
  return [
72
76
  y
@@ -24,14 +24,15 @@ from pylegend._typing import (
24
24
  PyLegendUnion,
25
25
  )
26
26
  from pylegend.core.sql.metamodel import QuerySpecification
27
- from pylegend.core.databse.sql_to_string import (
27
+ from pylegend.core.database.sql_to_string import (
28
28
  SqlToStringConfig,
29
29
  SqlToStringFormat
30
30
  )
31
- from pylegend.core.language import PyLegendPrimitive, TdsRow
31
+ from pylegend.core.language import PyLegendPrimitive, LegacyApiTdsRow
32
32
  from pylegend.core.tds.pandas_api.frames.pandas_api_tds_frame import PandasApiTdsFrame
33
33
  from pylegend.core.tds.tds_column import TdsColumn
34
34
  from pylegend.core.tds.tds_frame import FrameToSqlConfig
35
+ from pylegend.core.tds.tds_frame import FrameToPureConfig
35
36
  from pylegend.core.tds.result_handler import (
36
37
  ResultHandler,
37
38
  ToStringResultHandler,
@@ -64,7 +65,7 @@ class PandasApiBaseTdsFrame(PandasApiTdsFrame, metaclass=ABCMeta):
64
65
  def assign(
65
66
  self,
66
67
  **kwargs: PyLegendCallable[
67
- [TdsRow],
68
+ [LegacyApiTdsRow],
68
69
  PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]
69
70
  ],
70
71
  ) -> "PandasApiTdsFrame":
@@ -78,6 +79,13 @@ class PandasApiBaseTdsFrame(PandasApiTdsFrame, metaclass=ABCMeta):
78
79
  def to_sql_query_object(self, config: FrameToSqlConfig) -> QuerySpecification:
79
80
  pass # pragma: no cover
80
81
 
82
+ @abstractmethod
83
+ def to_pure(self, config: FrameToPureConfig) -> str:
84
+ pass # pragma: no cover
85
+
86
+ def to_pure_query(self, config: FrameToPureConfig = FrameToPureConfig()) -> str:
87
+ return self.to_pure(config)
88
+
81
89
  @abstractmethod
82
90
  def get_all_tds_frames(self) -> PyLegendList["PandasApiBaseTdsFrame"]:
83
91
  pass # pragma: no cover
@@ -21,7 +21,7 @@ from pylegend._typing import (
21
21
  )
22
22
  from pylegend.core.tds.tds_frame import PyLegendTdsFrame
23
23
  from pylegend.core.language import (
24
- TdsRow,
24
+ LegacyApiTdsRow,
25
25
  PyLegendPrimitive,
26
26
  )
27
27
 
@@ -36,7 +36,7 @@ class PandasApiTdsFrame(PyLegendTdsFrame):
36
36
  def assign(
37
37
  self,
38
38
  **kwargs: PyLegendCallable[
39
- [TdsRow],
39
+ [LegacyApiTdsRow],
40
40
  PyLegendUnion[int, float, bool, str, date, datetime, PyLegendPrimitive]
41
41
  ],
42
42
  ) -> "PandasApiTdsFrame":
@@ -21,7 +21,7 @@ from pylegend._typing import (
21
21
  PyLegendOptional,
22
22
  )
23
23
  from pylegend.core.tds.tds_column import TdsColumn
24
- from pylegend.core.databse.sql_to_string import SqlToStringGenerator
24
+ from pylegend.core.database.sql_to_string import SqlToStringGenerator
25
25
  from pylegend.core.tds.result_handler import ResultHandler
26
26
  from pylegend.extensions.tds.result_handler import PandasDfReadConfig
27
27
 
@@ -30,7 +30,8 @@ importlib.import_module(postgres_ext)
30
30
 
31
31
  __all__: PyLegendSequence[str] = [
32
32
  "PyLegendTdsFrame",
33
- "FrameToSqlConfig"
33
+ "FrameToSqlConfig",
34
+ "FrameToPureConfig",
34
35
  ]
35
36
 
36
37
 
@@ -56,6 +57,31 @@ class FrameToSqlConfig:
56
57
  return self.__sql_to_string_generator
57
58
 
58
59
 
60
+ class FrameToPureConfig:
61
+ __pretty: bool
62
+ __indent: str
63
+ __indent_level: int
64
+
65
+ def __init__(
66
+ self,
67
+ pretty: bool = True,
68
+ ident: str = " ",
69
+ indent_level: int = 0,
70
+ ) -> None:
71
+ self.__pretty = pretty
72
+ self.__indent = ident
73
+ self.__indent_level = indent_level
74
+
75
+ def push_indent(self, extra_indent_level: int = 1) -> "FrameToPureConfig":
76
+ return FrameToPureConfig(self.__pretty, self.__indent, self.__indent_level + extra_indent_level)
77
+
78
+ def separator(self, extra_indent_level: int = 0, return_space_if_not_pretty: bool = False) -> str:
79
+ if self.__pretty:
80
+ return "\n" + (self.__indent * (self.__indent_level + extra_indent_level))
81
+ else:
82
+ return " " if return_space_if_not_pretty else ""
83
+
84
+
59
85
  R = PyLegendTypeVar('R')
60
86
 
61
87
 
@@ -69,6 +95,10 @@ class PyLegendTdsFrame(metaclass=ABCMeta):
69
95
  def to_sql_query(self, config: FrameToSqlConfig = FrameToSqlConfig()) -> str:
70
96
  pass # pragma: no cover
71
97
 
98
+ @abstractmethod
99
+ def to_pure_query(self, config: FrameToPureConfig = FrameToPureConfig()) -> str:
100
+ pass # pragma: no cover
101
+
72
102
  @abstractmethod
73
103
  def execute_frame(
74
104
  self,
@@ -12,7 +12,7 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- from pylegend.core.databse.sql_to_string import (
15
+ from pylegend.core.database.sql_to_string import (
16
16
  SqlToStringGenerator,
17
17
  SqlToStringDbExtension,
18
18
  )
@@ -20,6 +20,7 @@ from pylegend._typing import (
20
20
  from pylegend.core.tds.tds_frame import (
21
21
  PyLegendTdsFrame,
22
22
  FrameToSqlConfig,
23
+ FrameToPureConfig,
23
24
  )
24
25
  from pylegend.core.project_cooridnates import ProjectCoordinates
25
26
  from pylegend.core.sql.metamodel import (
@@ -101,6 +102,9 @@ class LegendFunctionInputFrameAbstract(PyLegendTdsFrame, metaclass=ABCMeta):
101
102
  offset=None
102
103
  )
103
104
 
105
+ def to_pure(self, config: FrameToPureConfig) -> str:
106
+ raise RuntimeError("to_pure is not supported for LegendFunctionInputFrame")
107
+
104
108
  def get_path(self) -> str:
105
109
  return self.__path
106
110
 
@@ -20,6 +20,7 @@ from pylegend._typing import (
20
20
  from pylegend.core.tds.tds_frame import (
21
21
  PyLegendTdsFrame,
22
22
  FrameToSqlConfig,
23
+ FrameToPureConfig,
23
24
  )
24
25
  from pylegend.core.project_cooridnates import ProjectCoordinates
25
26
  from pylegend.core.sql.metamodel import (
@@ -101,6 +102,9 @@ class LegendServiceInputFrameAbstract(PyLegendTdsFrame, metaclass=ABCMeta):
101
102
  offset=None
102
103
  )
103
104
 
105
+ def to_pure(self, config: FrameToPureConfig) -> str:
106
+ raise RuntimeError("to_pure is not supported for LegendServiceInputFrame")
107
+
104
108
  def get_pattern(self) -> str:
105
109
  return self.__pattern
106
110
 
@@ -28,6 +28,7 @@ from pylegend.core.sql.metamodel import (
28
28
  )
29
29
  from pylegend.core.tds.tds_frame import PyLegendTdsFrame
30
30
  from pylegend.core.tds.tds_frame import FrameToSqlConfig
31
+ from pylegend.core.tds.tds_frame import FrameToPureConfig
31
32
 
32
33
  __all__: PyLegendSequence[str] = [
33
34
  "TableSpecInputFrameAbstract",
@@ -68,3 +69,6 @@ class TableSpecInputFrameAbstract(PyLegendTdsFrame, metaclass=ABCMeta):
68
69
  limit=None,
69
70
  offset=None
70
71
  )
72
+
73
+ def to_pure(self, config: FrameToPureConfig) -> str:
74
+ return f"#Table({'.'.join(self.table.parts)})#"
@@ -15,18 +15,18 @@
15
15
  from pylegend._typing import (
16
16
  PyLegendSequence
17
17
  )
18
- from pylegend.core.tds.legend_api.frames.legend_api_input_tds_frame import LegendApiExecutableInputTdsFrame
18
+ from pylegend.core.tds.legacy_api.frames.legacy_api_input_tds_frame import LegacyApiExecutableInputTdsFrame
19
19
  from pylegend.core.project_cooridnates import ProjectCoordinates
20
20
  from pylegend.core.request.legend_client import LegendClient
21
21
  from pylegend.extensions.tds.abstract.legend_function_input_frame import LegendFunctionInputFrameAbstract
22
22
 
23
23
 
24
24
  __all__: PyLegendSequence[str] = [
25
- "LegendApiLegendFunctionInputFrame"
25
+ "LegacyApiLegendFunctionInputFrame"
26
26
  ]
27
27
 
28
28
 
29
- class LegendApiLegendFunctionInputFrame(LegendFunctionInputFrameAbstract, LegendApiExecutableInputTdsFrame):
29
+ class LegacyApiLegendFunctionInputFrame(LegendFunctionInputFrameAbstract, LegacyApiExecutableInputTdsFrame):
30
30
 
31
31
  def __init__(
32
32
  self,
@@ -35,7 +35,7 @@ class LegendApiLegendFunctionInputFrame(LegendFunctionInputFrameAbstract, Legend
35
35
  legend_client: LegendClient,
36
36
  ) -> None:
37
37
  LegendFunctionInputFrameAbstract.__init__(self, path=path, project_coordinates=project_coordinates)
38
- LegendApiExecutableInputTdsFrame.__init__(
38
+ LegacyApiExecutableInputTdsFrame.__init__(
39
39
  self,
40
40
  legend_client=legend_client,
41
41
  columns=legend_client.get_sql_string_schema(self.to_sql_query())
@@ -43,4 +43,4 @@ class LegendApiLegendFunctionInputFrame(LegendFunctionInputFrameAbstract, Legend
43
43
  LegendFunctionInputFrameAbstract.set_initialized(self, True)
44
44
 
45
45
  def __str__(self) -> str:
46
- return f"LegendApiLegendFunctionInputFrame({'.'.join(self.get_path())})"
46
+ return f"LegacyApiLegendFunctionInputFrame({'.'.join(self.get_path())})"
@@ -15,18 +15,18 @@
15
15
  from pylegend._typing import (
16
16
  PyLegendSequence
17
17
  )
18
- from pylegend.core.tds.legend_api.frames.legend_api_input_tds_frame import LegendApiExecutableInputTdsFrame
18
+ from pylegend.core.tds.legacy_api.frames.legacy_api_input_tds_frame import LegacyApiExecutableInputTdsFrame
19
19
  from pylegend.core.project_cooridnates import ProjectCoordinates
20
20
  from pylegend.core.request.legend_client import LegendClient
21
21
  from pylegend.extensions.tds.abstract.legend_service_input_frame import LegendServiceInputFrameAbstract
22
22
 
23
23
 
24
24
  __all__: PyLegendSequence[str] = [
25
- "LegendApiLegendServiceInputFrame"
25
+ "LegacyApiLegendServiceInputFrame"
26
26
  ]
27
27
 
28
28
 
29
- class LegendApiLegendServiceInputFrame(LegendServiceInputFrameAbstract, LegendApiExecutableInputTdsFrame):
29
+ class LegacyApiLegendServiceInputFrame(LegendServiceInputFrameAbstract, LegacyApiExecutableInputTdsFrame):
30
30
 
31
31
  def __init__(
32
32
  self,
@@ -35,12 +35,12 @@ class LegendApiLegendServiceInputFrame(LegendServiceInputFrameAbstract, LegendAp
35
35
  legend_client: LegendClient,
36
36
  ) -> None:
37
37
  LegendServiceInputFrameAbstract.__init__(self, pattern=pattern, project_coordinates=project_coordinates)
38
- LegendApiExecutableInputTdsFrame.__init__(
38
+ LegacyApiExecutableInputTdsFrame.__init__(
39
39
  self,
40
40
  legend_client=legend_client,
41
41
  columns=legend_client.get_sql_string_schema(self.to_sql_query())
42
42
  )
43
- LegendApiLegendServiceInputFrame.set_initialized(self, True)
43
+ LegacyApiLegendServiceInputFrame.set_initialized(self, True)
44
44
 
45
45
  def __str__(self) -> str:
46
- return f"LegendApiLegendServiceInputFrame({'.'.join(self.get_pattern())})"
46
+ return f"LegacyApiLegendServiceInputFrame({'.'.join(self.get_pattern())})"
@@ -16,21 +16,21 @@ from pylegend._typing import (
16
16
  PyLegendList,
17
17
  PyLegendSequence
18
18
  )
19
- from pylegend.core.tds.legend_api.frames.legend_api_input_tds_frame import LegendApiNonExecutableInputTdsFrame
19
+ from pylegend.core.tds.legacy_api.frames.legacy_api_input_tds_frame import LegacyApiNonExecutableInputTdsFrame
20
20
  from pylegend.core.tds.tds_column import TdsColumn
21
21
  from pylegend.extensions.tds.abstract.table_spec_input_frame import TableSpecInputFrameAbstract
22
22
 
23
23
 
24
24
  __all__: PyLegendSequence[str] = [
25
- "LegendApiTableSpecInputFrame"
25
+ "LegacyApiTableSpecInputFrame"
26
26
  ]
27
27
 
28
28
 
29
- class LegendApiTableSpecInputFrame(TableSpecInputFrameAbstract, LegendApiNonExecutableInputTdsFrame):
29
+ class LegacyApiTableSpecInputFrame(TableSpecInputFrameAbstract, LegacyApiNonExecutableInputTdsFrame):
30
30
 
31
31
  def __init__(self, table_name_parts: PyLegendList[str], columns: PyLegendSequence[TdsColumn]) -> None:
32
32
  TableSpecInputFrameAbstract.__init__(self, table_name_parts=table_name_parts)
33
- LegendApiNonExecutableInputTdsFrame.__init__(self, columns=columns)
33
+ LegacyApiNonExecutableInputTdsFrame.__init__(self, columns=columns)
34
34
 
35
35
  def __str__(self) -> str:
36
- return f"LegendApiTableSpecInputFrame({'.'.join(self.table.parts)})"
36
+ return f"LegacyApiTableSpecInputFrame({'.'.join(self.table.parts)})"