cloudoll 3.0.8__tar.gz → 3.0.9__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-3.0.8 → cloudoll-3.0.9}/PKG-INFO +1 -1
- cloudoll-3.0.9/cloudoll/__init__.py +1 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/awsmysql.py +1 -1
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/awspostgres.py +8 -20
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/field.py +7 -4
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/test_sql.py +16 -1
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/PKG-INFO +1 -1
- {cloudoll-3.0.8 → cloudoll-3.0.9}/pyproject.toml +1 -1
- cloudoll-3.0.8/cloudoll/__init__.py +0 -1
- {cloudoll-3.0.8 → cloudoll-3.0.9}/LICENSE +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/README.md +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/__main__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/cli.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/cli_main.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/m2d.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/process.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/spinner.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/clitool/watch.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/logging/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/mail/smtp.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/base.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/err.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/model.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/mysql.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/parse.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/template/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/utils/common.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/utils/snowflake.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/__init__.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/core.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/exception.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/html.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/jwt.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/requests.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll/web/settings.py +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/requires.txt +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/setup.cfg +0 -0
- {cloudoll-3.0.8 → cloudoll-3.0.9}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudoll
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.9
|
|
4
4
|
Summary: Assist in quickly creating distributable microservices based on aiohttp, with a focus on simplicity and ease of use.
|
|
5
5
|
Home-page: https://github.com/smallerqiu/cloudoll-py
|
|
6
6
|
Author: Qiu
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "3.0.9"
|
|
@@ -9,6 +9,7 @@ from cloudoll.orm.base import MeteBase, QueryTypes
|
|
|
9
9
|
from cloudoll.logging import info, error
|
|
10
10
|
from psycopg2.extras import RealDictCursor
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
class AwsPostgres(MeteBase):
|
|
13
14
|
def __init__(self):
|
|
14
15
|
self.driver = "aws-postgres"
|
|
@@ -44,25 +45,12 @@ class AwsPostgres(MeteBase):
|
|
|
44
45
|
|
|
45
46
|
result = None
|
|
46
47
|
|
|
47
|
-
if query_type == QueryTypes.ALL
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
query_type == QueryTypes.ONE and cursor.description is not None
|
|
54
|
-
):
|
|
55
|
-
columns = [desc[0] for desc in cursor.target_cursor.description]
|
|
56
|
-
row = cursor.fetchone()
|
|
57
|
-
result = dict(zip(columns, row)) if row else {}
|
|
58
|
-
return result
|
|
59
|
-
elif (
|
|
60
|
-
query_type == QueryTypes.MANY and cursor.description is not None
|
|
61
|
-
):
|
|
62
|
-
columns = [desc[0] for desc in cursor.target_cursor.description]
|
|
63
|
-
rows = cursor.fetchmany(size)
|
|
64
|
-
result = [dict(zip(columns, row)) for row in rows]
|
|
65
|
-
return result
|
|
48
|
+
if query_type == QueryTypes.ALL:
|
|
49
|
+
return cursor.fetchall()
|
|
50
|
+
elif query_type == QueryTypes.ONE:
|
|
51
|
+
return cursor.fetchone()
|
|
52
|
+
elif query_type == QueryTypes.MANY:
|
|
53
|
+
return cursor.fetchmany(size)
|
|
66
54
|
elif query_type == QueryTypes.COUNT:
|
|
67
55
|
result = cursor.fetchone()
|
|
68
56
|
count = 0
|
|
@@ -89,5 +77,5 @@ class AwsPostgres(MeteBase):
|
|
|
89
77
|
elif query_type == QueryTypes.DELETE:
|
|
90
78
|
return cursor.rowcount > 0
|
|
91
79
|
except Exception as e:
|
|
92
|
-
error(f"[AWS PG] query error: {e}, SQL: {sql}")
|
|
80
|
+
error(f"[AWS PG] query error: {e}, SQL: {sql} params: {params}")
|
|
93
81
|
raise e
|
|
@@ -238,7 +238,6 @@ class FieldBase(object):
|
|
|
238
238
|
|
|
239
239
|
def contains(self, args):
|
|
240
240
|
return Function(self, OP.CONTAINS, args)
|
|
241
|
-
# return AO(f"contains({self.full_name},?)", args)
|
|
242
241
|
|
|
243
242
|
def As(self, args):
|
|
244
243
|
return Expression(self, OP.AS, args)
|
|
@@ -351,7 +350,6 @@ class Function(FieldBase):
|
|
|
351
350
|
return f"{col_name} < NOW() - INTERVAL {self.rpt} SECOND", None
|
|
352
351
|
elif op == OP.CONTAINS:
|
|
353
352
|
return f"{col_name} LIKE CONCAT('%%',?,'%%')", [self.rpt]
|
|
354
|
-
# return f"CONTAINS({col_name},?)", [self.rpt]
|
|
355
353
|
elif op == OP.JSON_CONTAINS_OBJECT:
|
|
356
354
|
_k, _v = self.rpt
|
|
357
355
|
key = _k.full_name if isinstance(_k, Field) else f"'{_k}'"
|
|
@@ -465,8 +463,13 @@ class Expression(FieldBase):
|
|
|
465
463
|
elif self.op == OP.AS:
|
|
466
464
|
q.append(r)
|
|
467
465
|
elif r is not None:
|
|
468
|
-
|
|
469
|
-
|
|
466
|
+
if isinstance(r, (list, tuple)):
|
|
467
|
+
# fix op is `in``
|
|
468
|
+
q.append(f"({','.join(['?'] * len(r))})")
|
|
469
|
+
p.extend(r)
|
|
470
|
+
else:
|
|
471
|
+
q.append("?")
|
|
472
|
+
p.append(r)
|
|
470
473
|
if not is_fun and not isinstance(l, Field):
|
|
471
474
|
q.append(")")
|
|
472
475
|
q = [str(num) for num in q]
|
|
@@ -63,7 +63,7 @@ class C(Model):
|
|
|
63
63
|
is_timeout = models.BooleanField(default="true", not_null=True)
|
|
64
64
|
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
def test_query():
|
|
67
67
|
sql, arg = (
|
|
68
68
|
B.use()
|
|
69
69
|
.select(
|
|
@@ -87,3 +87,18 @@ if __name__ == "__main__":
|
|
|
87
87
|
)
|
|
88
88
|
# sql = B()._exchange_sql(sql)
|
|
89
89
|
print(sql, arg)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_a():
|
|
93
|
+
role_id = ("5", 4, 7, 6)
|
|
94
|
+
sql, arg = (
|
|
95
|
+
B.use()
|
|
96
|
+
.join(A, A.id == B.id)
|
|
97
|
+
.where(B.proxy_order_no.In(role_id), B.channel_type == 0, A.id.In(role_id))
|
|
98
|
+
.test()
|
|
99
|
+
)
|
|
100
|
+
print(sql, tuple(arg))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
test_a()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cloudoll
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.9
|
|
4
4
|
Summary: Assist in quickly creating distributable microservices based on aiohttp, with a focus on simplicity and ease of use.
|
|
5
5
|
Home-page: https://github.com/smallerqiu/cloudoll-py
|
|
6
6
|
Author: Qiu
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cloudoll"
|
|
7
|
-
version = "3.0.
|
|
7
|
+
version = "3.0.9"
|
|
8
8
|
description = "Assist in quickly creating distributable microservices based on aiohttp, with a focus on simplicity and ease of use."
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Qiu", email = "smallerqiu@gmail.com"},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "3.0.8"
|
|
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
|