SQLExecX 2.2.7__tar.gz → 2.2.8__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.
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/PKG-INFO +2 -2
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/SQLExecX.egg-info/PKG-INFO +2 -2
- SQLExecX-2.2.8/SQLExecX.egg-info/requires.txt +1 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/setup.py +2 -2
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/__init__.py +57 -5
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/loader.py +2 -2
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/log_support.py +3 -3
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/table_exec.py +6 -6
- SQLExecX-2.2.7/SQLExecX.egg-info/requires.txt +0 -1
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/LICENSE +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/README.rst +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/SQLExecX.egg-info/SOURCES.txt +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/SQLExecX.egg-info/dependency_links.txt +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/SQLExecX.egg-info/not-zip-safe +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/SQLExecX.egg-info/top_level.txt +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/setup.cfg +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/constant.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/dialect.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/exec.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/page_exec.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/sql_exec.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/sql_support.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/table_limit_exec.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/table_order_by.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/table_page_exec.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/table_support.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/sqlexecx/utils.py +0 -0
- {SQLExecX-2.2.7 → SQLExecX-2.2.8}/test/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SQLExecX
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.8
|
|
4
4
|
Summary: A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.
|
|
5
5
|
Home-page: https://gitee.com/summry/sqlexecx
|
|
6
6
|
Author: summy
|
|
@@ -9,7 +9,7 @@ Keywords: SQL,MySQL,PostgreSQL,SQLite,Database,Python,RDB
|
|
|
9
9
|
Requires-Python: >=3.6
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: sqlexecutorx>=1.9.
|
|
12
|
+
Requires-Dist: sqlexecutorx>=1.9.5
|
|
13
13
|
|
|
14
14
|
Usage Sample
|
|
15
15
|
''''''''''''
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SQLExecX
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.8
|
|
4
4
|
Summary: A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.
|
|
5
5
|
Home-page: https://gitee.com/summry/sqlexecx
|
|
6
6
|
Author: summy
|
|
@@ -9,7 +9,7 @@ Keywords: SQL,MySQL,PostgreSQL,SQLite,Database,Python,RDB
|
|
|
9
9
|
Requires-Python: >=3.6
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: sqlexecutorx>=1.9.
|
|
12
|
+
Requires-Dist: sqlexecutorx>=1.9.5
|
|
13
13
|
|
|
14
14
|
Usage Sample
|
|
15
15
|
''''''''''''
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sqlexecutorx>=1.9.5
|
|
@@ -17,9 +17,9 @@ setup(
|
|
|
17
17
|
description="A easy, fast sql executor for Python. Supported MySQL, PostgreSQL, SQLite etc.",
|
|
18
18
|
long_description=long_description,
|
|
19
19
|
long_description_content_type='text/markdown',
|
|
20
|
-
version='2.2.
|
|
20
|
+
version='2.2.8',
|
|
21
21
|
install_requires=[
|
|
22
|
-
'sqlexecutorx>=1.9.
|
|
22
|
+
'sqlexecutorx>=1.9.5',
|
|
23
23
|
],
|
|
24
24
|
url='https://gitee.com/summry/sqlexecx',
|
|
25
25
|
author='summy',
|
|
@@ -26,7 +26,6 @@ export LRU_CACHE_SIZE=128
|
|
|
26
26
|
windows:
|
|
27
27
|
set LRU_CACHE_SIZE=128
|
|
28
28
|
"""
|
|
29
|
-
from typing import Optional
|
|
30
29
|
from sqlexecutorx import (
|
|
31
30
|
conn,
|
|
32
31
|
trans,
|
|
@@ -86,7 +85,63 @@ from .dialect import Dialect
|
|
|
86
85
|
from .table_exec import table
|
|
87
86
|
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
__all__ = [
|
|
89
|
+
'init',
|
|
90
|
+
'sql',
|
|
91
|
+
'page',
|
|
92
|
+
'Dialect',
|
|
93
|
+
'table',
|
|
94
|
+
'conn',
|
|
95
|
+
'trans',
|
|
96
|
+
'get_connection',
|
|
97
|
+
'close',
|
|
98
|
+
'Driver',
|
|
99
|
+
'Engine',
|
|
100
|
+
'InitArgs',
|
|
101
|
+
'execute',
|
|
102
|
+
'insert',
|
|
103
|
+
'save',
|
|
104
|
+
'save_sql',
|
|
105
|
+
'save_select_key',
|
|
106
|
+
'save_sql_select_key',
|
|
107
|
+
'batch_insert',
|
|
108
|
+
'batch_execute',
|
|
109
|
+
'get',
|
|
110
|
+
'select',
|
|
111
|
+
'select_one',
|
|
112
|
+
'select_first',
|
|
113
|
+
'query',
|
|
114
|
+
'query_one',
|
|
115
|
+
'query_first',
|
|
116
|
+
'ravel_list',
|
|
117
|
+
'select_page',
|
|
118
|
+
'query_page',
|
|
119
|
+
'load',
|
|
120
|
+
'do_execute',
|
|
121
|
+
'do_save_sql',
|
|
122
|
+
'do_save_sql_select_key',
|
|
123
|
+
'do_get',
|
|
124
|
+
'do_select',
|
|
125
|
+
'do_select_one',
|
|
126
|
+
'do_select_first',
|
|
127
|
+
'do_query',
|
|
128
|
+
'do_query_one',
|
|
129
|
+
'do_query_first',
|
|
130
|
+
'do_ravel_list',
|
|
131
|
+
'do_select_page',
|
|
132
|
+
'do_query_page',
|
|
133
|
+
'do_load',
|
|
134
|
+
'insert_from_df',
|
|
135
|
+
'insert_from_pl',
|
|
136
|
+
'insert_from_csv',
|
|
137
|
+
'insert_from_json',
|
|
138
|
+
'truncate_table',
|
|
139
|
+
'drop_table',
|
|
140
|
+
'show_tables',
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def init(*args, **kwargs) -> Engine:
|
|
90
145
|
"""
|
|
91
146
|
Compliant with the Python DB API 2.0 (PEP-249).
|
|
92
147
|
|
|
@@ -109,8 +164,5 @@ def init(*args, **kwargs) -> Optional[Engine]:
|
|
|
109
164
|
"""
|
|
110
165
|
|
|
111
166
|
engine = _init(*args, **kwargs)
|
|
112
|
-
if engine is None:
|
|
113
|
-
return None
|
|
114
|
-
|
|
115
167
|
Dialect.init(engine)
|
|
116
168
|
return engine
|
|
@@ -18,7 +18,7 @@ class Loader:
|
|
|
18
18
|
"""
|
|
19
19
|
try:
|
|
20
20
|
import pandas as pd
|
|
21
|
-
except:
|
|
21
|
+
except ModuleNotFoundError:
|
|
22
22
|
raise ModuleNotFoundError("No module named 'pandas', please install it use 'pip install pandas'")
|
|
23
23
|
if self.description:
|
|
24
24
|
description = [x[0] for x in self.description]
|
|
@@ -34,7 +34,7 @@ class Loader:
|
|
|
34
34
|
"""
|
|
35
35
|
try:
|
|
36
36
|
import polars as pl
|
|
37
|
-
except:
|
|
37
|
+
except ModuleNotFoundError:
|
|
38
38
|
raise ModuleNotFoundError("No module named 'polars', please install it use 'pip install polars'")
|
|
39
39
|
if self.description:
|
|
40
40
|
description = [x[0] for x in self.description]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from sqlexecutorx.log_support import logger, do_sql_log, do_save_log, batch_sql_log, db_ctx_log
|
|
1
|
+
from sqlexecutorx.log_support import logger, do_sql_log as _do_sql_log, do_save_log, batch_sql_log, db_ctx_log
|
|
2
2
|
from .constant import MODULE
|
|
3
3
|
|
|
4
4
|
|
|
@@ -11,11 +11,11 @@ def save_log(function: str, select_key: str, table: str, **kwargs):
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def sql_log(function: str, sql: str, *args, **kwargs):
|
|
14
|
-
logger.debug(f"Exec func '{function}' \n\tsql: {sql.strip()} \n\targs: {args} \n\tkwargs: {kwargs}")
|
|
14
|
+
logger.debug(f"Exec func '{MODULE}.{function}' \n\tsql: {sql.strip()} \n\targs: {args} \n\tkwargs: {kwargs}")
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def do_sql_log(function: str, sql: str, *args):
|
|
18
|
-
|
|
18
|
+
_do_sql_log(MODULE, function, sql, *args)
|
|
19
19
|
|
|
20
20
|
#
|
|
21
21
|
# def db_ctx_log(action, connection):
|
|
@@ -421,7 +421,7 @@ class WhereExec(WhereBase):
|
|
|
421
421
|
|
|
422
422
|
class ColumnExec:
|
|
423
423
|
|
|
424
|
-
def __init__(self, table_exec:
|
|
424
|
+
def __init__(self, table_exec: TableExec, *columns):
|
|
425
425
|
self.table_exec = table_exec
|
|
426
426
|
self.columns = columns
|
|
427
427
|
|
|
@@ -639,7 +639,7 @@ class ColumnExec:
|
|
|
639
639
|
self.table_exec.page(page_num, page_size, return_total), *self.columns
|
|
640
640
|
)
|
|
641
641
|
|
|
642
|
-
def limit(self, limit: Union[int, Tuple[int], List[int]] = 10) -> ColumnLimitExec:
|
|
642
|
+
def limit(self, limit: Union[int, Tuple[int, int], List[int]] = 10) -> ColumnLimitExec:
|
|
643
643
|
"""
|
|
644
644
|
Get a ColumnLimitExec instance
|
|
645
645
|
|
|
@@ -664,7 +664,7 @@ class ColumnExec:
|
|
|
664
664
|
return ColumnOrderByExec(self.table_exec.order_by(order_by), *self.columns)
|
|
665
665
|
|
|
666
666
|
|
|
667
|
-
class
|
|
667
|
+
class TableExec:
|
|
668
668
|
|
|
669
669
|
def __init__(self, _exec, table_name):
|
|
670
670
|
self.exec = _exec
|
|
@@ -1046,7 +1046,7 @@ class Table:
|
|
|
1046
1046
|
|
|
1047
1047
|
|
|
1048
1048
|
@lru_cache(maxsize=CACHE_SIZE)
|
|
1049
|
-
def table(table_name: str) ->
|
|
1049
|
+
def table(table_name: str) -> TableExec:
|
|
1050
1050
|
"""
|
|
1051
1051
|
Get a Table instance
|
|
1052
1052
|
|
|
@@ -1054,8 +1054,8 @@ def table(table_name: str) -> Table:
|
|
|
1054
1054
|
--------
|
|
1055
1055
|
>>> import sqlexecx as db
|
|
1056
1056
|
>>> db.table('person')
|
|
1057
|
-
|
|
1057
|
+
TableExec()
|
|
1058
1058
|
"""
|
|
1059
1059
|
table_name = table_name.strip()
|
|
1060
1060
|
assert table_name, "Parameter 'table' must not be none"
|
|
1061
|
-
return
|
|
1061
|
+
return TableExec(exec, table_name)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
sqlexecutorx>=1.9.2
|
|
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
|