cloudoll 2.2.35__tar.gz → 2.2.36__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.35 → cloudoll-2.2.36}/PKG-INFO +1 -1
- cloudoll-2.2.36/cloudoll/__init__.py +1 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/__init__.py +2 -2
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/base.py +5 -4
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/model.py +6 -5
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/__init__.py +1 -1
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/PKG-INFO +1 -1
- cloudoll-2.2.35/cloudoll/__init__.py +0 -1
- {cloudoll-2.2.35 → cloudoll-2.2.36}/LICENSE +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/README.md +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/__main__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/cli.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/error/__init__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/error/errors.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/logging/__init__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/mail/__init__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/mail/smtp.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/err.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/field.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/mysql.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/parse.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/orm/postgres.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/robot/__init__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/robot/dingtalk.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/robot/feishu.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/robot/slack.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/__init__.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/common.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/m2d.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/patch_loop.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/snowflake.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/utils/watch.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/exception.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/html.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/http.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/jwt.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll/web/settings.py +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/SOURCES.txt +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/dependency_links.txt +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/entry_points.txt +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/requires.txt +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/cloudoll.egg-info/top_level.txt +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/setup.cfg +0 -0
- {cloudoll-2.2.35 → cloudoll-2.2.36}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.2.36"
|
|
@@ -115,7 +115,7 @@ class Postgres(MeteBase):
|
|
|
115
115
|
# self.pool.release(cursor)
|
|
116
116
|
|
|
117
117
|
async def query(self, sql, params=None, query_type: QueryTypes = 2, size: int = 10):
|
|
118
|
-
sql = sql.replace("?", "%s").replace(
|
|
118
|
+
sql = sql.replace("?", "%s").replace("`", '"')
|
|
119
119
|
if not self.pool:
|
|
120
120
|
raise ValueError("must be create_engine first.")
|
|
121
121
|
if self.pool._closing or self.pool._closed:
|
|
@@ -124,7 +124,7 @@ class Postgres(MeteBase):
|
|
|
124
124
|
async with self.pool.acquire() as conn:
|
|
125
125
|
if conn.echo:
|
|
126
126
|
print_info("sql", sql, params)
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
async with conn.cursor() as cursor:
|
|
129
129
|
# current_cursor = getattr(cursor, 'lastrowid', None)
|
|
130
130
|
if (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from enum import Enum
|
|
2
|
+
from typing import Tuple
|
|
2
3
|
|
|
3
4
|
|
|
4
5
|
class QueryTypes(Enum):
|
|
@@ -47,7 +48,7 @@ class MeteBase:
|
|
|
47
48
|
async def query(
|
|
48
49
|
self, sql, params=None, query_type: QueryTypes = 2, size: int = 10
|
|
49
50
|
): ...
|
|
50
|
-
|
|
51
|
+
|
|
51
52
|
async def all(self, sql, params):
|
|
52
53
|
return await self.query(sql, params, QueryTypes.ALL)
|
|
53
54
|
|
|
@@ -62,15 +63,15 @@ class MeteBase:
|
|
|
62
63
|
|
|
63
64
|
async def update(self, sql, params):
|
|
64
65
|
return await self.query(sql, params, QueryTypes.UPDATE)
|
|
65
|
-
|
|
66
|
+
|
|
66
67
|
async def update_batch(self, sql, params):
|
|
67
68
|
return await self.query(sql, params, QueryTypes.UPDATEBATCH)
|
|
68
69
|
|
|
69
70
|
async def delete(self, sql, params):
|
|
70
71
|
return await self.query(sql, params, QueryTypes.DELETE)
|
|
71
72
|
|
|
72
|
-
async def create(self, sql, params):
|
|
73
|
+
async def create(self, sql, params) -> Tuple[bool, int]:
|
|
73
74
|
return await self.query(sql, params, QueryTypes.CREATE)
|
|
74
|
-
|
|
75
|
+
|
|
75
76
|
async def create_batch(self, sql, params):
|
|
76
77
|
return await self.query(sql, params, QueryTypes.CREATEBATCH)
|
|
@@ -6,6 +6,7 @@ import copy
|
|
|
6
6
|
import re
|
|
7
7
|
import datetime
|
|
8
8
|
from ..utils.common import Object
|
|
9
|
+
from typing import Tuple
|
|
9
10
|
|
|
10
11
|
__ALL__ = ("models", "Model")
|
|
11
12
|
|
|
@@ -149,7 +150,7 @@ class Model(metaclass=ModelMetaclass):
|
|
|
149
150
|
@classmethod
|
|
150
151
|
def use(cls, pool=None):
|
|
151
152
|
cls.__pool__ = pool
|
|
152
|
-
cls.__ispg = cls.__pool__.driver == "postgres"
|
|
153
|
+
cls.__ispg = cls.__pool__.driver == "postgres" if pool else False
|
|
153
154
|
return cls()
|
|
154
155
|
|
|
155
156
|
def select(cls, *args):
|
|
@@ -432,10 +433,10 @@ class Model(metaclass=ModelMetaclass):
|
|
|
432
433
|
sql = self._exchange_sql(sql)
|
|
433
434
|
return await self.__pool__.delete(sql, args)
|
|
434
435
|
|
|
435
|
-
async def insert(self, *args, **kw):
|
|
436
|
+
async def insert(self, *args, **kw) -> Tuple[bool, int]:
|
|
436
437
|
table = self.__table__
|
|
437
438
|
keys, params = self._get_insert_key_args("i", args or kw)
|
|
438
|
-
escape_keys = [f
|
|
439
|
+
escape_keys = [f"`{k}`" for k in keys]
|
|
439
440
|
sql = f"insert into `{table}` ({','.join(escape_keys)}) values ({','.join(['?' for k in keys])})"
|
|
440
441
|
self._reset()
|
|
441
442
|
params = tuple(key for key in params)
|
|
@@ -446,12 +447,12 @@ class Model(metaclass=ModelMetaclass):
|
|
|
446
447
|
if len(items) == 0:
|
|
447
448
|
return 0
|
|
448
449
|
keys, params = self._get_batch_keys_values(items)
|
|
449
|
-
escape_keys = [f
|
|
450
|
+
escape_keys = [f"`{k}`" for k in keys]
|
|
450
451
|
sql = f"insert into `{table}` ({','.join(escape_keys)}) values ({','.join(['?' for k in keys])})"
|
|
451
452
|
self._reset()
|
|
452
453
|
return await self.__pool__.create_batch(sql, params)
|
|
453
454
|
|
|
454
|
-
async def count(self):
|
|
455
|
+
async def count(self) -> int:
|
|
455
456
|
__where__ = copy.copy(self.__where__)
|
|
456
457
|
__join__ = copy.copy(self.__join__)
|
|
457
458
|
cls = copy.deepcopy(self)
|
|
@@ -508,7 +508,7 @@ class JsonEncoder(json.JSONEncoder):
|
|
|
508
508
|
return list(obj)
|
|
509
509
|
elif isinstance(obj, Model):
|
|
510
510
|
return obj.__dict__
|
|
511
|
-
elif isinstance(obj, uuid.UUID):
|
|
511
|
+
elif isinstance(obj, uuid.UUID) or isinstance(obj, Exception):
|
|
512
512
|
return str(obj)
|
|
513
513
|
else:
|
|
514
514
|
return super(JsonEncoder, self).default(obj)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "2.2.35"
|
|
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
|