cloudoll 2.2.29__tar.gz → 2.2.30__tar.gz
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.
- {cloudoll-2.2.29 → cloudoll-2.2.30}/PKG-INFO +1 -1
- cloudoll-2.2.30/cloudoll/__init__.py +1 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/field.py +70 -7
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/PKG-INFO +1 -1
- cloudoll-2.2.29/cloudoll/__init__.py +0 -1
- {cloudoll-2.2.29 → cloudoll-2.2.30}/LICENSE +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/README.md +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/__main__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/cli.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/error/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/error/errors.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/logging/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/mail/smtp.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/base.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/err.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/model.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/mysql.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/parse.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/robot/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/robot/dingtalk.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/robot/feishu.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/robot/slack.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/common.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/m2d.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/patch_loop.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/snowflake.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/utils/watch.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/__init__.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/exception.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/html.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/http.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/jwt.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll/web/settings.py +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/requires.txt +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/setup.cfg +0 -0
- {cloudoll-2.2.29 → cloudoll-2.2.30}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.30"
|
|
@@ -55,6 +55,10 @@ OP = objdict(
|
|
|
55
55
|
GROUP_CONCAT='GROUP_CONCAT',
|
|
56
56
|
COUNT="COUNT",
|
|
57
57
|
COUNT_WHEN="COUNT_WHEN",
|
|
58
|
+
SUM_WHEN="SUM_WHEN",
|
|
59
|
+
MAX_WHEN="MAX_WHEN",
|
|
60
|
+
MIN_WHEN="MIN_WHEN",
|
|
61
|
+
AVG_WHEN="AVG_WHEN",
|
|
58
62
|
IS_NOT="IS NOT",
|
|
59
63
|
IS_NOT_NULL="IS NOT NULL",
|
|
60
64
|
IS_NULL="IS NULL",
|
|
@@ -122,18 +126,53 @@ class FieldBase(object):
|
|
|
122
126
|
def count(self):
|
|
123
127
|
return Function(self, OP.COUNT)
|
|
124
128
|
|
|
129
|
+
def count_when(self, *arg):
|
|
130
|
+
"""
|
|
131
|
+
input: count_when(A.field > 10 ,1 , 0) \n
|
|
132
|
+
output: count(case when A.field > 10 then 1 else 0 end)
|
|
133
|
+
"""
|
|
134
|
+
return Function(self, OP.COUNT_WHEN, arg)
|
|
135
|
+
|
|
125
136
|
def max(self):
|
|
126
137
|
return Function(self, OP.MAX)
|
|
127
138
|
|
|
128
|
-
def
|
|
129
|
-
|
|
139
|
+
def max_when(self, *arg):
|
|
140
|
+
"""
|
|
141
|
+
input: max_when(A.field > 10 ,A.field) \n
|
|
142
|
+
output: max(case when A.field > 10 then A.field end)
|
|
143
|
+
"""
|
|
144
|
+
return Function(self, OP.MAX_WHEN, arg)
|
|
145
|
+
|
|
146
|
+
def min(self):
|
|
147
|
+
return Function(self, OP.MIN)
|
|
148
|
+
|
|
149
|
+
def min_when(self, *arg):
|
|
150
|
+
"""
|
|
151
|
+
input: min_when(A.field > 10 ,A.field) \n
|
|
152
|
+
output: min(case when A.field > 10 then A.field end)
|
|
153
|
+
"""
|
|
154
|
+
return Function(self, OP.MIN_WHEN, arg)
|
|
130
155
|
|
|
131
156
|
def sum(self):
|
|
132
157
|
return Function(self, OP.SUM)
|
|
133
158
|
|
|
159
|
+
def sum_when(self, *arg):
|
|
160
|
+
"""
|
|
161
|
+
input: sum_when(A.field > 10 ,1 , 0)\n
|
|
162
|
+
output: sum(case when A.field > 10 then 1 else 0 end)
|
|
163
|
+
"""
|
|
164
|
+
return Function(self, OP.SUM_WHEN, arg)
|
|
165
|
+
|
|
134
166
|
def avg(self):
|
|
135
167
|
return Function(self, OP.AVG)
|
|
136
168
|
|
|
169
|
+
def avg_when(self, *arg):
|
|
170
|
+
"""
|
|
171
|
+
input: avg_when(A.field > 10 , A.field)\n
|
|
172
|
+
output: avg(case when A.field > 10 then A.field end)
|
|
173
|
+
"""
|
|
174
|
+
return Function(self, OP.AVG_WHEN, arg)
|
|
175
|
+
|
|
137
176
|
def date_format(self, args):
|
|
138
177
|
return Function(self, OP.DATE_FORMAT, args)
|
|
139
178
|
|
|
@@ -243,6 +282,20 @@ class ExpList(FieldBase):
|
|
|
243
282
|
# return f"{lpt.sql() if isinstance(lpt,Expression) else lpt} {self.op} {rpt.sql() if isinstance(rpt,Expression) else rpt}"
|
|
244
283
|
|
|
245
284
|
|
|
285
|
+
def deconstruct(args):
|
|
286
|
+
f = args[0] if len(args) > 0 else None
|
|
287
|
+
v1 = args[1] if len(args) > 1 else 1
|
|
288
|
+
v2 = args[2] if len(args) > 2 and args[2] is not None else 'NULL'
|
|
289
|
+
c = None
|
|
290
|
+
v = None
|
|
291
|
+
if isinstance(f, FieldBase):
|
|
292
|
+
c = f"{f.lhs.full_name} {f.op} ?"
|
|
293
|
+
v = f.rhs
|
|
294
|
+
if isinstance(v1, FieldBase):
|
|
295
|
+
v1 = v1.name
|
|
296
|
+
return c, v, v1, v2
|
|
297
|
+
|
|
298
|
+
|
|
246
299
|
class Function(FieldBase):
|
|
247
300
|
def __init__(self, col, op, rpt=None):
|
|
248
301
|
self.col = col
|
|
@@ -299,23 +352,33 @@ class Function(FieldBase):
|
|
|
299
352
|
return f"json_contains({col_name},json_object({key},?))", [_v]
|
|
300
353
|
elif op == OP.JSON_CONTAINS_ARRAY:
|
|
301
354
|
if is_field:
|
|
302
|
-
return (
|
|
303
|
-
f"json_contains({col_name},json_array({self.rpt.full_name}))",
|
|
304
|
-
None,
|
|
305
|
-
)
|
|
355
|
+
return f"json_contains({col_name},json_array({self.rpt.full_name}))", None
|
|
306
356
|
return f"json_contains({col_name},json_array(?))", [self.rpt]
|
|
307
357
|
elif op == OP.COUNT:
|
|
308
358
|
return f"COUNT({col_name})", None
|
|
309
359
|
elif op == OP.COUNT_WHEN:
|
|
310
|
-
|
|
360
|
+
c, v, v1, v2 = deconstruct(self.rpt)
|
|
361
|
+
return f"COUNT(CASE WHEN {c} THEN {v1} ELSE {v2} END)", [v]
|
|
311
362
|
elif op == OP.SUM:
|
|
312
363
|
return f"SUM({col_name})", None
|
|
364
|
+
elif op == OP.SUM_WHEN:
|
|
365
|
+
c, v, v1, v2 = deconstruct(self.rpt)
|
|
366
|
+
return f"SUM(CASE WHEN {c} THEN {v1} ELSE {v2} END)", [v]
|
|
313
367
|
elif op == OP.AVG:
|
|
314
368
|
return f"AVG({col_name})", None
|
|
369
|
+
elif op == OP.AVG_WHEN:
|
|
370
|
+
c, v, v1, v2 = deconstruct(self.rpt)
|
|
371
|
+
return f"AVG(CASE WHEN {c} THEN {v1} ELSE {v2} END)", [v]
|
|
315
372
|
elif op == OP.MAX:
|
|
316
373
|
return f"MAX({col_name})", None
|
|
374
|
+
elif op == OP.MAX_WHEN:
|
|
375
|
+
c, v, v1, v2 = deconstruct(self.rpt)
|
|
376
|
+
return f"MAX(CASE WHEN {c} THEN {v1} ELSE {v2} END)", [v]
|
|
317
377
|
elif op == OP.MIN:
|
|
318
378
|
return f"MIN({col_name})", None
|
|
379
|
+
elif op == OP.MIN_WHEN:
|
|
380
|
+
c, v, v1, v2 = deconstruct(self.rpt)
|
|
381
|
+
return f"MIN(CASE WHEN {c} THEN {v1} ELSE {v2} END)", [v]
|
|
319
382
|
elif op == OP.GROUP_CONCAT:
|
|
320
383
|
return f"GROUP_CONCAT({col_name})", None
|
|
321
384
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.29"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|