sqlctx-dax 0.14.0__cp311-abi3-win_amd64.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.
- sqlctx_dax/__init__.py +263 -0
- sqlctx_dax/_native.pyd +0 -0
- sqlctx_dax/ast.py +1364 -0
- sqlctx_dax/py.typed +0 -0
- sqlctx_dax-0.14.0.dist-info/METADATA +43 -0
- sqlctx_dax-0.14.0.dist-info/RECORD +8 -0
- sqlctx_dax-0.14.0.dist-info/WHEEL +4 -0
- sqlctx_dax-0.14.0.dist-info/sboms/dax-pyo3.cyclonedx.json +878 -0
sqlctx_dax/__init__.py
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from . import ast as ast
|
|
7
|
+
from .ast import (
|
|
8
|
+
Amp,
|
|
9
|
+
AndAnd,
|
|
10
|
+
Arrow,
|
|
11
|
+
AstNodeKind,
|
|
12
|
+
AstNodeSpan,
|
|
13
|
+
Binary,
|
|
14
|
+
BinaryOp,
|
|
15
|
+
Blank,
|
|
16
|
+
Boolean,
|
|
17
|
+
BracketIdentToken,
|
|
18
|
+
BracketRef,
|
|
19
|
+
Caret,
|
|
20
|
+
Colon,
|
|
21
|
+
ColumnDef,
|
|
22
|
+
Comma,
|
|
23
|
+
CommentKind,
|
|
24
|
+
DataTable,
|
|
25
|
+
DataTableColumn,
|
|
26
|
+
DataTableType,
|
|
27
|
+
DateTime,
|
|
28
|
+
DateTimeToken,
|
|
29
|
+
DefineBlock,
|
|
30
|
+
Definition,
|
|
31
|
+
Dialect,
|
|
32
|
+
DocCommentToken,
|
|
33
|
+
Dot,
|
|
34
|
+
Eof,
|
|
35
|
+
Eq,
|
|
36
|
+
EqEq,
|
|
37
|
+
EvaluateStmt,
|
|
38
|
+
Expr,
|
|
39
|
+
FuncParam,
|
|
40
|
+
FunctionCall,
|
|
41
|
+
FunctionDef,
|
|
42
|
+
Gt,
|
|
43
|
+
Gte,
|
|
44
|
+
HierarchyRef,
|
|
45
|
+
Identifier,
|
|
46
|
+
IdentToken,
|
|
47
|
+
LBrace,
|
|
48
|
+
LosslessParse,
|
|
49
|
+
LParen,
|
|
50
|
+
Lt,
|
|
51
|
+
Lte,
|
|
52
|
+
MeasureDef,
|
|
53
|
+
Minus,
|
|
54
|
+
ModelMetadata,
|
|
55
|
+
ModelTable,
|
|
56
|
+
ModelValidationCode,
|
|
57
|
+
ModelValidationIssue,
|
|
58
|
+
Neq,
|
|
59
|
+
Number,
|
|
60
|
+
NumberToken,
|
|
61
|
+
Omitted,
|
|
62
|
+
OrderKey,
|
|
63
|
+
OrOr,
|
|
64
|
+
Parameter,
|
|
65
|
+
ParamToken,
|
|
66
|
+
Paren,
|
|
67
|
+
Plus,
|
|
68
|
+
Query,
|
|
69
|
+
QuotedIdentToken,
|
|
70
|
+
RBrace,
|
|
71
|
+
RecoveredItem,
|
|
72
|
+
RecoveredQueryItem,
|
|
73
|
+
RecoveryDiagnostic,
|
|
74
|
+
RecoveryPhase,
|
|
75
|
+
RecoveryResult,
|
|
76
|
+
RParen,
|
|
77
|
+
Semicolon,
|
|
78
|
+
Slash,
|
|
79
|
+
SortDirection,
|
|
80
|
+
SourceComment,
|
|
81
|
+
Span,
|
|
82
|
+
Star,
|
|
83
|
+
String,
|
|
84
|
+
StringToken,
|
|
85
|
+
TableColumnRef,
|
|
86
|
+
TableConstructor,
|
|
87
|
+
TableDef,
|
|
88
|
+
TableName,
|
|
89
|
+
TableRef,
|
|
90
|
+
Token,
|
|
91
|
+
TokenKind,
|
|
92
|
+
Tuple,
|
|
93
|
+
Unary,
|
|
94
|
+
UnaryOp,
|
|
95
|
+
ValidationCode,
|
|
96
|
+
ValidationIssue,
|
|
97
|
+
VarBlock,
|
|
98
|
+
VarDecl,
|
|
99
|
+
VarDef,
|
|
100
|
+
VisualShape,
|
|
101
|
+
VisualShapeAxis,
|
|
102
|
+
VisualShapeColumn,
|
|
103
|
+
VisualShapeGroup,
|
|
104
|
+
format_expression,
|
|
105
|
+
format_query,
|
|
106
|
+
from_raw_expr,
|
|
107
|
+
from_raw_query,
|
|
108
|
+
from_raw_tokens,
|
|
109
|
+
lex,
|
|
110
|
+
parse_expression,
|
|
111
|
+
parse_expression_lossless,
|
|
112
|
+
parse_query,
|
|
113
|
+
parse_query_lossless,
|
|
114
|
+
recover_expression,
|
|
115
|
+
recover_query,
|
|
116
|
+
validate_expression,
|
|
117
|
+
validate_expression_against_model,
|
|
118
|
+
validate_query,
|
|
119
|
+
validate_query_against_model,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def parse_expression_raw(text: str) -> Any:
|
|
124
|
+
native = _native_module()
|
|
125
|
+
return json.loads(native.parse_expression(text))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def parse_query_raw(text: str) -> Any:
|
|
129
|
+
native = _native_module()
|
|
130
|
+
return json.loads(native.parse_query(text))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def lex_raw(text: str) -> Any:
|
|
134
|
+
native = _native_module()
|
|
135
|
+
return json.loads(native.lex(text))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def _native_module():
|
|
139
|
+
try:
|
|
140
|
+
from . import _native
|
|
141
|
+
except Exception as exc: # pragma: no cover - exercised via import in runtime
|
|
142
|
+
raise RuntimeError("sqlctx_dax native module is not available") from exc
|
|
143
|
+
return _native
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
__all__ = [
|
|
147
|
+
"Amp",
|
|
148
|
+
"AndAnd",
|
|
149
|
+
"Arrow",
|
|
150
|
+
"AstNodeKind",
|
|
151
|
+
"AstNodeSpan",
|
|
152
|
+
"Binary",
|
|
153
|
+
"BinaryOp",
|
|
154
|
+
"Blank",
|
|
155
|
+
"Boolean",
|
|
156
|
+
"BracketIdentToken",
|
|
157
|
+
"BracketRef",
|
|
158
|
+
"Caret",
|
|
159
|
+
"Colon",
|
|
160
|
+
"ColumnDef",
|
|
161
|
+
"Comma",
|
|
162
|
+
"CommentKind",
|
|
163
|
+
"DefineBlock",
|
|
164
|
+
"Definition",
|
|
165
|
+
"Dialect",
|
|
166
|
+
"DateTime",
|
|
167
|
+
"DateTimeToken",
|
|
168
|
+
"DataTable",
|
|
169
|
+
"DataTableColumn",
|
|
170
|
+
"DataTableType",
|
|
171
|
+
"DocCommentToken",
|
|
172
|
+
"Dot",
|
|
173
|
+
"Eof",
|
|
174
|
+
"Eq",
|
|
175
|
+
"EqEq",
|
|
176
|
+
"EvaluateStmt",
|
|
177
|
+
"Expr",
|
|
178
|
+
"FuncParam",
|
|
179
|
+
"FunctionDef",
|
|
180
|
+
"FunctionCall",
|
|
181
|
+
"Gt",
|
|
182
|
+
"Gte",
|
|
183
|
+
"HierarchyRef",
|
|
184
|
+
"IdentToken",
|
|
185
|
+
"Identifier",
|
|
186
|
+
"LBrace",
|
|
187
|
+
"LParen",
|
|
188
|
+
"Lt",
|
|
189
|
+
"Lte",
|
|
190
|
+
"LosslessParse",
|
|
191
|
+
"MeasureDef",
|
|
192
|
+
"ModelMetadata",
|
|
193
|
+
"ModelTable",
|
|
194
|
+
"ModelValidationCode",
|
|
195
|
+
"ModelValidationIssue",
|
|
196
|
+
"Minus",
|
|
197
|
+
"Neq",
|
|
198
|
+
"Number",
|
|
199
|
+
"NumberToken",
|
|
200
|
+
"Omitted",
|
|
201
|
+
"OrOr",
|
|
202
|
+
"OrderKey",
|
|
203
|
+
"Paren",
|
|
204
|
+
"Parameter",
|
|
205
|
+
"ParamToken",
|
|
206
|
+
"Plus",
|
|
207
|
+
"Query",
|
|
208
|
+
"QuotedIdentToken",
|
|
209
|
+
"RBrace",
|
|
210
|
+
"RecoveredItem",
|
|
211
|
+
"RecoveredQueryItem",
|
|
212
|
+
"RecoveryDiagnostic",
|
|
213
|
+
"RecoveryPhase",
|
|
214
|
+
"RecoveryResult",
|
|
215
|
+
"RParen",
|
|
216
|
+
"Semicolon",
|
|
217
|
+
"Slash",
|
|
218
|
+
"SortDirection",
|
|
219
|
+
"SourceComment",
|
|
220
|
+
"Span",
|
|
221
|
+
"Star",
|
|
222
|
+
"String",
|
|
223
|
+
"StringToken",
|
|
224
|
+
"TableColumnRef",
|
|
225
|
+
"TableConstructor",
|
|
226
|
+
"TableDef",
|
|
227
|
+
"TableName",
|
|
228
|
+
"TableRef",
|
|
229
|
+
"Token",
|
|
230
|
+
"TokenKind",
|
|
231
|
+
"Tuple",
|
|
232
|
+
"Unary",
|
|
233
|
+
"UnaryOp",
|
|
234
|
+
"VarBlock",
|
|
235
|
+
"VarDecl",
|
|
236
|
+
"VarDef",
|
|
237
|
+
"ValidationCode",
|
|
238
|
+
"ValidationIssue",
|
|
239
|
+
"VisualShape",
|
|
240
|
+
"VisualShapeAxis",
|
|
241
|
+
"VisualShapeColumn",
|
|
242
|
+
"VisualShapeGroup",
|
|
243
|
+
"ast",
|
|
244
|
+
"from_raw_expr",
|
|
245
|
+
"from_raw_query",
|
|
246
|
+
"from_raw_tokens",
|
|
247
|
+
"format_expression",
|
|
248
|
+
"format_query",
|
|
249
|
+
"lex",
|
|
250
|
+
"lex_raw",
|
|
251
|
+
"parse_expression",
|
|
252
|
+
"parse_expression_lossless",
|
|
253
|
+
"parse_expression_raw",
|
|
254
|
+
"parse_query",
|
|
255
|
+
"parse_query_lossless",
|
|
256
|
+
"parse_query_raw",
|
|
257
|
+
"recover_expression",
|
|
258
|
+
"recover_query",
|
|
259
|
+
"validate_expression",
|
|
260
|
+
"validate_expression_against_model",
|
|
261
|
+
"validate_query",
|
|
262
|
+
"validate_query_against_model",
|
|
263
|
+
]
|
sqlctx_dax/_native.pyd
ADDED
|
Binary file
|