MySQLX 2.3.0__tar.gz → 2.3.1__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.3.0 → MySQLX-2.3.1/MySQLX.egg-info}/PKG-INFO +3 -5
- MySQLX-2.3.1/MySQLX.egg-info/requires.txt +2 -0
- {MySQLX-2.3.0/MySQLX.egg-info → MySQLX-2.3.1}/PKG-INFO +3 -5
- MySQLX-2.3.1/mysqlx/__init__.py +75 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/sql_holder.py +2 -2
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/sql_support.py +1 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/support.py +1 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/setup.py +2 -2
- MySQLX-2.3.0/MySQLX.egg-info/requires.txt +0 -2
- MySQLX-2.3.0/mysqlx/__init__.py +0 -42
- {MySQLX-2.3.0 → MySQLX-2.3.1}/LICENSE +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/MySQLX.egg-info/SOURCES.txt +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/MySQLX.egg-info/dependency_links.txt +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/MySQLX.egg-info/not-zip-safe +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/MySQLX.egg-info/top_level.txt +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/README.rst +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/constant.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/db.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/dbx.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/log_support.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/sql_id_exec.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/sql_mapper.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/mysqlx/sql_page_exec.py +0 -0
- {MySQLX-2.3.0 → MySQLX-2.3.1}/setup.cfg +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MySQLX
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: A thread safe sql executor for MySQL like MyBatis with connection pool. It helps you automatically manage database connections and transactions.
|
|
5
5
|
Home-page: https://gitee.com/summry/mysqlx
|
|
6
6
|
Author: summy
|
|
7
7
|
Author-email: xiazhongbiao@126.com
|
|
8
|
-
License: UNKNOWN
|
|
9
8
|
Keywords: sql,MySQL,MyBatis,python
|
|
10
|
-
Platform: UNKNOWN
|
|
11
9
|
Requires-Python: >=3.5
|
|
12
10
|
Description-Content-Type: text/markdown
|
|
13
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: Jinja2>=2.7.0
|
|
13
|
+
Requires-Dist: sqlexecx>=2.2.4
|
|
14
14
|
|
|
15
15
|
Mapper file
|
|
16
16
|
'''''''''''
|
|
@@ -177,5 +177,3 @@ If you want to operate PostgreSQL database, may be you need PgSQLX: https://pypi
|
|
|
177
177
|
If you just wanted a simple sql executor, may be you need SQLExecX: https://pypi.org/project/sqlexecx
|
|
178
178
|
|
|
179
179
|
If you wanted simultaneously support MySQL and PostgreSQL, may be you need BatisX: https://pypi.org/project/batisx
|
|
180
|
-
|
|
181
|
-
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: MySQLX
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: A thread safe sql executor for MySQL like MyBatis with connection pool. It helps you automatically manage database connections and transactions.
|
|
5
5
|
Home-page: https://gitee.com/summry/mysqlx
|
|
6
6
|
Author: summy
|
|
7
7
|
Author-email: xiazhongbiao@126.com
|
|
8
|
-
License: UNKNOWN
|
|
9
8
|
Keywords: sql,MySQL,MyBatis,python
|
|
10
|
-
Platform: UNKNOWN
|
|
11
9
|
Requires-Python: >=3.5
|
|
12
10
|
Description-Content-Type: text/markdown
|
|
13
11
|
License-File: LICENSE
|
|
12
|
+
Requires-Dist: Jinja2>=2.7.0
|
|
13
|
+
Requires-Dist: sqlexecx>=2.2.4
|
|
14
14
|
|
|
15
15
|
Mapper file
|
|
16
16
|
'''''''''''
|
|
@@ -177,5 +177,3 @@ If you want to operate PostgreSQL database, may be you need PgSQLX: https://pypi
|
|
|
177
177
|
If you just wanted a simple sql executor, may be you need SQLExecX: https://pypi.org/project/sqlexecx
|
|
178
178
|
|
|
179
179
|
If you wanted simultaneously support MySQL and PostgreSQL, may be you need BatisX: https://pypi.org/project/batisx
|
|
180
|
-
|
|
181
|
-
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"""
|
|
2
|
+
可以设置`SQL_CACHE_SIZE`环境变量来设置缓存大小,默认是128。
|
|
3
|
+
linux or macos:
|
|
4
|
+
export SQL_CACHE_SIZE=256
|
|
5
|
+
windows:
|
|
6
|
+
set SQL_CACHE_SIZE=256
|
|
7
|
+
|
|
8
|
+
可以设置`LRU_CACHE_SIZE`环境变量来设置缓存大小,默认是64。
|
|
9
|
+
linux or macos:
|
|
10
|
+
export LRU_CACHE_SIZE=128
|
|
11
|
+
windows:
|
|
12
|
+
set LRU_CACHE_SIZE=128
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from sqlexecx import (
|
|
16
|
+
conn,
|
|
17
|
+
trans,
|
|
18
|
+
get_connection,
|
|
19
|
+
close,
|
|
20
|
+
Driver,
|
|
21
|
+
Dialect,
|
|
22
|
+
Engine,
|
|
23
|
+
init as _init
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
from .support import InitArgs
|
|
27
|
+
from .log_support import logger
|
|
28
|
+
from .sql_mapper import sql, mapper
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def init_db(*args, **kwargs) -> Engine:
|
|
32
|
+
"""
|
|
33
|
+
Compliant with the Python DB API 2.0 (PEP-249).
|
|
34
|
+
|
|
35
|
+
Addition parameters:
|
|
36
|
+
- mapper_path: str, path of mapper files
|
|
37
|
+
- driver=None: str|Driver, 'psycopg2' or 'pymysql' or 'mysql.connector' or 'sqlite3' or 'turso'
|
|
38
|
+
- pool_size=0: int, default 0, size of connection pool
|
|
39
|
+
- show_sql=False: bool, if True, print sql
|
|
40
|
+
- debug=False: bool, if True, print debug context
|
|
41
|
+
|
|
42
|
+
Other parameters of connection pool refer to DBUtils: https://webwareforpython.github.io/DBUtils/main.html#pooleddb-pooled-db
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
>>> from mysqlx import db, trans, init_db
|
|
47
|
+
>>> init_db('db.sqlite3', mapper_path='./mapper', driver='sqlite3', debug=True)
|
|
48
|
+
Engine.SQLITE
|
|
49
|
+
>>> init_db(user='root', password='xxx', host='127.0.0.1', port=3306, database='testdb', driver='pymysql', mapper_path='./mapper')
|
|
50
|
+
Engine.MYSQL
|
|
51
|
+
"""
|
|
52
|
+
from .sql_holder import load_mapper
|
|
53
|
+
|
|
54
|
+
# Dialect.init(Engine.MYSQL)
|
|
55
|
+
mapper_path = kwargs.pop(InitArgs.MAPPER_PATH) if InitArgs.MAPPER_PATH in kwargs else None
|
|
56
|
+
engine = _init(*args, **kwargs)
|
|
57
|
+
assert engine in (Engine.MYSQL, Engine.SQLITE, Engine.TURSO)
|
|
58
|
+
if mapper_path:
|
|
59
|
+
load_mapper(mapper_path)
|
|
60
|
+
return engine
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
__all__ = [
|
|
64
|
+
'conn',
|
|
65
|
+
'trans',
|
|
66
|
+
'get_connection',
|
|
67
|
+
'close',
|
|
68
|
+
'Driver',
|
|
69
|
+
'Dialect',
|
|
70
|
+
'Engine',
|
|
71
|
+
'init_db',
|
|
72
|
+
'sql',
|
|
73
|
+
'mapper'
|
|
74
|
+
]
|
|
75
|
+
|
|
@@ -64,11 +64,11 @@ def do_get_sql(sql_model, batch, param_names, *args, **kwargs):
|
|
|
64
64
|
return sql_model.sql, args
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
def build_sql_id(namespace, _id):
|
|
67
|
+
def build_sql_id(namespace, _id) -> str:
|
|
68
68
|
return f'{namespace}.{_id}'
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
def get_sql_model(sql_id: str):
|
|
71
|
+
def get_sql_model(sql_id: str) -> SqlModel:
|
|
72
72
|
global _SQL_CONTAINER
|
|
73
73
|
return _SQL_CONTAINER[sql_id]
|
|
74
74
|
|
|
@@ -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.2.
|
|
22
|
+
'sqlexecx>=2.2.4',
|
|
23
23
|
],
|
|
24
|
-
version='2.3.
|
|
24
|
+
version='2.3.1',
|
|
25
25
|
url='https://gitee.com/summry/mysqlx',
|
|
26
26
|
author='summy',
|
|
27
27
|
author_email='xiazhongbiao@126.com',
|
MySQLX-2.3.0/mysqlx/__init__.py
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from sqlexecx import (
|
|
2
|
-
conn,
|
|
3
|
-
trans,
|
|
4
|
-
get_connection,
|
|
5
|
-
close,
|
|
6
|
-
Driver,
|
|
7
|
-
Dialect,
|
|
8
|
-
Engine,
|
|
9
|
-
init as _init
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
from .support import InitArgs
|
|
13
|
-
from .sql_mapper import sql, mapper
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def init_db(*args, **kwargs):
|
|
17
|
-
"""
|
|
18
|
-
Compliant with the Python DB API 2.0 (PEP-249).
|
|
19
|
-
|
|
20
|
-
from mysqlx import init_db
|
|
21
|
-
init_db('test.db', driver='sqlite3', show_sql=True, debug=True)
|
|
22
|
-
or
|
|
23
|
-
init_db("postgres://user:password@127.0.0.1:5432/testdb", mapper_path='./mapper', driver='psycopg2', pool_size=5, show_sql=True, debug=True)
|
|
24
|
-
or
|
|
25
|
-
init_db(user='root', password='xxx', host='127.0.0.1', port=3306, database='testdb', mapper_path='./mapper', driver='pymysql', pool_size=5, show_sql=True, debug=True)
|
|
26
|
-
|
|
27
|
-
Addition parameters:
|
|
28
|
-
:param mapper_path: str, path of mapper files
|
|
29
|
-
:param driver=None: str, import driver, 'import pymysql'
|
|
30
|
-
:param pool_size=0: int, default 0, size of connection pool
|
|
31
|
-
:param show_sql=False: bool, if True, print sql
|
|
32
|
-
:param debug=False: bool, if True, print debug context
|
|
33
|
-
|
|
34
|
-
Other parameters of connection pool refer to DBUtils: https://webwareforpython.github.io/DBUtils/main.html#pooleddb-pooled-db
|
|
35
|
-
"""
|
|
36
|
-
from .sql_holder import load_mapper
|
|
37
|
-
|
|
38
|
-
# Dialect.init(Engine.MYSQL)
|
|
39
|
-
mapper_path = kwargs.pop(InitArgs.MAPPER_PATH) if InitArgs.MAPPER_PATH in kwargs else None
|
|
40
|
-
_init(*args, **kwargs)
|
|
41
|
-
if mapper_path:
|
|
42
|
-
load_mapper(mapper_path)
|
|
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
|