MySQLX 2.2.4__tar.gz → 2.2.5__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.
- {mysqlx-2.2.4 → mysqlx-2.2.5}/PKG-INFO +4 -4
- {mysqlx-2.2.4 → mysqlx-2.2.5}/README.rst +3 -3
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/__init__.py +2 -4
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/sql_holder.py +7 -5
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/sql_mapper.py +8 -4
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/support.py +1 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx.egg-info/PKG-INFO +4 -4
- mysqlx-2.2.5/mysqlx.egg-info/requires.txt +2 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/setup.py +2 -2
- mysqlx-2.2.4/mysqlx.egg-info/requires.txt +0 -2
- {mysqlx-2.2.4 → mysqlx-2.2.5}/LICENSE +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/constant.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/db.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/dbx.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/log_support.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/sql_id_exec.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/sql_page_exec.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx/sql_support.py +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx.egg-info/SOURCES.txt +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx.egg-info/dependency_links.txt +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx.egg-info/not-zip-safe +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/mysqlx.egg-info/top_level.txt +0 -0
- {mysqlx-2.2.4 → mysqlx-2.2.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mysqlx
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.5
|
|
4
4
|
Summary: A thread safe sql executor for MySQL like MyBatis with connection pool. It helps you automatically manage database connections and transactions. It also provides ORM operations for single tables.
|
|
5
5
|
Home-page: https://gitee.com/summry/mysqlx
|
|
6
6
|
Author: summy
|
|
@@ -136,16 +136,16 @@ Transaction
|
|
|
136
136
|
|
|
137
137
|
.. code:: python
|
|
138
138
|
|
|
139
|
-
from mysqlx import
|
|
139
|
+
from mysqlx import trans
|
|
140
140
|
|
|
141
|
-
@
|
|
141
|
+
@trans
|
|
142
142
|
def test_transaction():
|
|
143
143
|
insert_func(....)
|
|
144
144
|
update_func(....)
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
def test_transaction2():
|
|
148
|
-
with
|
|
148
|
+
with trans():
|
|
149
149
|
insert_func(....)
|
|
150
150
|
update_func(....)
|
|
151
151
|
|
|
@@ -122,16 +122,16 @@ Transaction
|
|
|
122
122
|
|
|
123
123
|
.. code:: python
|
|
124
124
|
|
|
125
|
-
from mysqlx import
|
|
125
|
+
from mysqlx import trans
|
|
126
126
|
|
|
127
|
-
@
|
|
127
|
+
@trans
|
|
128
128
|
def test_transaction():
|
|
129
129
|
insert_func(....)
|
|
130
130
|
update_func(....)
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
def test_transaction2():
|
|
134
|
-
with
|
|
134
|
+
with trans():
|
|
135
135
|
insert_func(....)
|
|
136
136
|
update_func(....)
|
|
137
137
|
|
|
@@ -46,13 +46,13 @@ def do_get_sql(sql_model, batch, param_names, *args, **kwargs):
|
|
|
46
46
|
:return:
|
|
47
47
|
"""
|
|
48
48
|
if sql_model.dynamic:
|
|
49
|
-
if not kwargs:
|
|
50
|
-
raise MapperError("Parameter 'kwargs' must not be empty when named mapping sql.")
|
|
51
49
|
sql = sql_model.sql.render(**kwargs)
|
|
52
|
-
|
|
50
|
+
# 去掉空行
|
|
51
|
+
sql = '\n\t'.join([line for line in sql.rstrip().split('\n\t') if line.strip()])
|
|
52
|
+
logger.debug(f"Original sql: {sql}")
|
|
53
53
|
return get_named_sql_args(sql, **kwargs)
|
|
54
54
|
else:
|
|
55
|
-
logger.debug("Original sql: {
|
|
55
|
+
logger.debug(f"Original sql: {sql_model.sql}")
|
|
56
56
|
if sql_model.mapping and kwargs:
|
|
57
57
|
return get_named_sql_args(sql_model.sql, **kwargs)
|
|
58
58
|
elif sql_model.placeholder and kwargs:
|
|
@@ -65,7 +65,7 @@ def do_get_sql(sql_model, batch, param_names, *args, **kwargs):
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
def build_sql_id(namespace, _id):
|
|
68
|
-
return namespace
|
|
68
|
+
return f'{namespace}.{_id}'
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
def get_sql_model(sql_id: str):
|
|
@@ -179,4 +179,6 @@ def _load_sql(namespace, child, file):
|
|
|
179
179
|
|
|
180
180
|
|
|
181
181
|
def _valid_sql(sql_id, sql, tag):
|
|
182
|
+
if tag in (SqlAction.SQL.value, SqlAction.CALL.value):
|
|
183
|
+
return
|
|
182
184
|
assert tag in _valid_sql_actions and tag in sql.lower(), "Sql id: '{}' has not '{}' key word in {} sql.".format(sql_id, tag, tag)
|
|
@@ -87,16 +87,20 @@ def get_exec_func(func, action, batch):
|
|
|
87
87
|
def get_select_func(func):
|
|
88
88
|
names = func.__code__.co_names
|
|
89
89
|
is_list = 'list' in names or 'List' in names
|
|
90
|
-
|
|
90
|
+
is_dict = 'dict' in names or 'Mapping' in names
|
|
91
|
+
is_tuple = 'tuple' in names or 'Tuple' in names
|
|
92
|
+
if is_dict and is_list:
|
|
91
93
|
return sqlexecx.do_query
|
|
92
|
-
elif
|
|
94
|
+
elif is_tuple and is_list:
|
|
95
|
+
return sqlexecx.do_select
|
|
96
|
+
elif is_dict in names:
|
|
93
97
|
return sqlexecx.do_query_one
|
|
94
98
|
elif len(names) == 1 and names[0] in ('int', 'float', 'Decimal', 'str', 'AnyStr', 'date', 'time', 'datetime'):
|
|
95
99
|
return sqlexecx.do_get
|
|
96
100
|
elif len(names) == 1 and names[0] in ('tuple', 'Tuple'):
|
|
97
101
|
return sqlexecx.do_select_one
|
|
98
|
-
elif is_list:
|
|
99
|
-
return sqlexecx.
|
|
102
|
+
elif is_list and len(names) == 2:
|
|
103
|
+
return sqlexecx.do_ravel_list
|
|
100
104
|
else:
|
|
101
105
|
return sqlexecx.do_query
|
|
102
106
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mysqlx
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.5
|
|
4
4
|
Summary: A thread safe sql executor for MySQL like MyBatis with connection pool. It helps you automatically manage database connections and transactions. It also provides ORM operations for single tables.
|
|
5
5
|
Home-page: https://gitee.com/summry/mysqlx
|
|
6
6
|
Author: summy
|
|
@@ -136,16 +136,16 @@ Transaction
|
|
|
136
136
|
|
|
137
137
|
.. code:: python
|
|
138
138
|
|
|
139
|
-
from mysqlx import
|
|
139
|
+
from mysqlx import trans
|
|
140
140
|
|
|
141
|
-
@
|
|
141
|
+
@trans
|
|
142
142
|
def test_transaction():
|
|
143
143
|
insert_func(....)
|
|
144
144
|
update_func(....)
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
def test_transaction2():
|
|
148
|
-
with
|
|
148
|
+
with trans():
|
|
149
149
|
insert_func(....)
|
|
150
150
|
update_func(....)
|
|
151
151
|
|
|
@@ -19,9 +19,9 @@ setup(
|
|
|
19
19
|
long_description_content_type='text/markdown',
|
|
20
20
|
install_requires=[
|
|
21
21
|
'Jinja2>=2.7.0',
|
|
22
|
-
'sqlexecx>=2.1.
|
|
22
|
+
'sqlexecx>=2.1.4',
|
|
23
23
|
],
|
|
24
|
-
version='2.2.
|
|
24
|
+
version='2.2.5',
|
|
25
25
|
url='https://gitee.com/summry/mysqlx',
|
|
26
26
|
author='summy',
|
|
27
27
|
author_email='xiazhongbiao@126.com',
|
|
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
|