reydb 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
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.
- reydb/__init__.py +1 -1
- reydb/rall.py +1 -1
- reydb/rconfig.py +9 -4
- reydb/rdb.py +59 -39
- reydb/rerror.py +9 -4
- reydb/rexec.py +104 -103
- reydb/{rparam.py → rinfo.py} +50 -43
- {reydb-1.2.0.dist-info → reydb-1.2.1.dist-info}/METADATA +1 -1
- reydb-1.2.1.dist-info/RECORD +15 -0
- reydb-1.2.0.dist-info/RECORD +0 -15
- {reydb-1.2.0.dist-info → reydb-1.2.1.dist-info}/WHEEL +0 -0
- {reydb-1.2.0.dist-info → reydb-1.2.1.dist-info}/licenses/LICENSE +0 -0
reydb/__init__.py
CHANGED
reydb/rall.py
CHANGED
reydb/rconfig.py
CHANGED
@@ -41,8 +41,17 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
41
41
|
"""
|
42
42
|
Database config super type.
|
43
43
|
Can create database used `self.build_db` method.
|
44
|
+
|
45
|
+
Attributes
|
46
|
+
----------
|
47
|
+
db_names : Database table name mapping dictionary.
|
44
48
|
"""
|
45
49
|
|
50
|
+
db_names = {
|
51
|
+
'config': 'config',
|
52
|
+
'stats_config': 'stats_config'
|
53
|
+
}
|
54
|
+
|
46
55
|
|
47
56
|
def __init__(self, db: DatabaseT) -> None:
|
48
57
|
"""
|
@@ -55,10 +64,6 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
55
64
|
|
56
65
|
# Build.
|
57
66
|
self.db = db
|
58
|
-
self.db_names = {
|
59
|
-
'config': 'config',
|
60
|
-
'stats_config': 'stats_config'
|
61
|
-
}
|
62
67
|
|
63
68
|
|
64
69
|
def handle_build_db(self) -> None:
|
reydb/rdb.py
CHANGED
@@ -16,7 +16,7 @@ from sqlalchemy import Engine, create_engine as sqlalchemy_create_engine
|
|
16
16
|
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine as sqlalchemy_create_async_engine
|
17
17
|
from reykit.rtext import join_data_text
|
18
18
|
|
19
|
-
from . import rbase, rbuild, rconfig, rconn, rerror, rexec,
|
19
|
+
from . import rbase, rbuild, rconfig, rconn, rerror, rexec, rinfo, rorm
|
20
20
|
|
21
21
|
|
22
22
|
__all__ = (
|
@@ -31,11 +31,31 @@ DatabaseExecuteT = TypeVar('DatabaseExecuteT', 'rexec.DatabaseExecute', 'rexec.D
|
|
31
31
|
DatabaseORMT = TypeVar('DatabaseORMT', 'rorm.DatabaseORM', 'rorm.DatabaseORMAsync')
|
32
32
|
DatabaseBuildT = TypeVar('DatabaseBuildT', 'rbuild.DatabaseBuild', 'rbuild.DatabaseBuildAsync')
|
33
33
|
DatabaseConfigT = TypeVar('DatabaseConfigT', 'rconfig.DatabaseConfig', 'rconfig.DatabaseConfigAsync')
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
DatabaseInformationSchemaT = TypeVar(
|
35
|
+
'DatabaseInformationSchemaT',
|
36
|
+
'rinfo.DatabaseInformationSchema',
|
37
|
+
'rinfo.DatabaseInformationSchemaAsync'
|
38
|
+
)
|
39
|
+
DatabaseInformationParameterVariablesT = TypeVar(
|
40
|
+
'DatabaseInformationParameterVariablesT',
|
41
|
+
'rinfo.DatabaseInformationParameterVariables',
|
42
|
+
'rinfo.DatabaseInformationParameterVariablesAsync'
|
43
|
+
)
|
44
|
+
DatabaseInformationParameterStatusT = TypeVar(
|
45
|
+
'DatabaseInformationParameterStatusT',
|
46
|
+
'rinfo.DatabaseInformationParameterStatus',
|
47
|
+
'rinfo.DatabaseInformationParameterStatusAsync'
|
48
|
+
)
|
49
|
+
DatabaseInformationParameterVariablesGlobalT = TypeVar(
|
50
|
+
'DatabaseInformationParameterVariablesGlobalT',
|
51
|
+
'rinfo.DatabaseInformationParameterVariablesGlobal',
|
52
|
+
'rinfo.DatabaseInformationParameterVariablesGlobalAsync'
|
53
|
+
)
|
54
|
+
DatabaseInformationParameterStatusGlobalT = TypeVar(
|
55
|
+
'DatabaseInformationParameterStatusGlobalT',
|
56
|
+
'rinfo.DatabaseInformationParameterStatusGlobal',
|
57
|
+
'rinfo.DatabaseInformationParameterStatusGlobalAsync'
|
58
|
+
)
|
39
59
|
|
40
60
|
|
41
61
|
class DatabaseSuper(
|
@@ -47,11 +67,11 @@ class DatabaseSuper(
|
|
47
67
|
DatabaseORMT,
|
48
68
|
DatabaseBuildT,
|
49
69
|
DatabaseConfigT,
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
70
|
+
DatabaseInformationSchemaT,
|
71
|
+
DatabaseInformationParameterVariablesT,
|
72
|
+
DatabaseInformationParameterStatusT,
|
73
|
+
DatabaseInformationParameterVariablesGlobalT,
|
74
|
+
DatabaseInformationParameterStatusGlobalT
|
55
75
|
]
|
56
76
|
):
|
57
77
|
"""
|
@@ -70,7 +90,7 @@ class DatabaseSuper(
|
|
70
90
|
max_overflow: int = 10,
|
71
91
|
pool_timeout: float = 30.0,
|
72
92
|
pool_recycle: int | None = 3600,
|
73
|
-
|
93
|
+
echo: bool = False,
|
74
94
|
**query: str
|
75
95
|
) -> None:
|
76
96
|
"""
|
@@ -89,7 +109,7 @@ class DatabaseSuper(
|
|
89
109
|
pool_recycle : Number of seconds `recycle` connection.
|
90
110
|
- `None | Literal[-1]`: No recycle.
|
91
111
|
- `int`: Use this value.
|
92
|
-
|
112
|
+
echo : Whether report SQL execute information, not include ORM execute.
|
93
113
|
query : Remote server database parameters.
|
94
114
|
"""
|
95
115
|
|
@@ -110,7 +130,7 @@ class DatabaseSuper(
|
|
110
130
|
self.pool_recycle = -1
|
111
131
|
else:
|
112
132
|
self.pool_recycle = pool_recycle
|
113
|
-
self.
|
133
|
+
self.echo = echo
|
114
134
|
self.query = query
|
115
135
|
|
116
136
|
## Schema.
|
@@ -380,7 +400,7 @@ class DatabaseSuper(
|
|
380
400
|
|
381
401
|
|
382
402
|
@property
|
383
|
-
def schema(self) ->
|
403
|
+
def schema(self) -> DatabaseInformationSchemaT:
|
384
404
|
"""
|
385
405
|
Build database schema instance.
|
386
406
|
|
@@ -392,15 +412,15 @@ class DatabaseSuper(
|
|
392
412
|
# Build.
|
393
413
|
match self:
|
394
414
|
case Database():
|
395
|
-
schema =
|
415
|
+
schema = rinfo.DatabaseInformationSchema(self)
|
396
416
|
case DatabaseAsync():
|
397
|
-
schema =
|
417
|
+
schema = rinfo.DatabaseInformationSchemaAsync(self)
|
398
418
|
|
399
419
|
return schema
|
400
420
|
|
401
421
|
|
402
422
|
@property
|
403
|
-
def var(self) ->
|
423
|
+
def var(self) -> DatabaseInformationParameterVariablesT:
|
404
424
|
"""
|
405
425
|
Build database parameters variable instance.
|
406
426
|
|
@@ -412,15 +432,15 @@ class DatabaseSuper(
|
|
412
432
|
# Build.
|
413
433
|
match self:
|
414
434
|
case Database():
|
415
|
-
var =
|
435
|
+
var = rinfo.DatabaseInformationParameterVariables(self)
|
416
436
|
case DatabaseAsync():
|
417
|
-
var =
|
437
|
+
var = rinfo.DatabaseInformationParameterVariablesAsync(self)
|
418
438
|
|
419
439
|
return var
|
420
440
|
|
421
441
|
|
422
442
|
@property
|
423
|
-
def stat(self) ->
|
443
|
+
def stat(self) -> DatabaseInformationParameterVariablesT:
|
424
444
|
"""
|
425
445
|
Build database parameters status instance.
|
426
446
|
|
@@ -432,15 +452,15 @@ class DatabaseSuper(
|
|
432
452
|
# Build.
|
433
453
|
match self:
|
434
454
|
case Database():
|
435
|
-
stat =
|
455
|
+
stat = rinfo.DatabaseInformationParameterStatus(self)
|
436
456
|
case DatabaseAsync():
|
437
|
-
stat =
|
457
|
+
stat = rinfo.DatabaseInformationParameterStatusAsync(self)
|
438
458
|
|
439
459
|
return stat
|
440
460
|
|
441
461
|
|
442
462
|
@property
|
443
|
-
def glob_var(self) ->
|
463
|
+
def glob_var(self) -> DatabaseInformationParameterVariablesGlobalT:
|
444
464
|
"""
|
445
465
|
Build global database parameters variable instance.
|
446
466
|
|
@@ -452,15 +472,15 @@ class DatabaseSuper(
|
|
452
472
|
# Build.
|
453
473
|
match self:
|
454
474
|
case Database():
|
455
|
-
var =
|
475
|
+
var = rinfo.DatabaseInformationParameterVariablesGlobal(self)
|
456
476
|
case DatabaseAsync():
|
457
|
-
var =
|
477
|
+
var = rinfo.DatabaseInformationParameterVariablesGlobalAsync(self)
|
458
478
|
|
459
479
|
return var
|
460
480
|
|
461
481
|
|
462
482
|
@property
|
463
|
-
def glob_stat(self) ->
|
483
|
+
def glob_stat(self) -> DatabaseInformationParameterStatusGlobalT:
|
464
484
|
"""
|
465
485
|
Build global database parameters status instance.
|
466
486
|
|
@@ -472,9 +492,9 @@ class DatabaseSuper(
|
|
472
492
|
# Build.
|
473
493
|
match self:
|
474
494
|
case Database():
|
475
|
-
stat =
|
495
|
+
stat = rinfo.DatabaseInformationParameterStatusGlobal(self)
|
476
496
|
case DatabaseAsync():
|
477
|
-
stat =
|
497
|
+
stat = rinfo.DatabaseInformationParameterStatusGlobalAsync(self)
|
478
498
|
|
479
499
|
return stat
|
480
500
|
|
@@ -487,11 +507,11 @@ class Database(
|
|
487
507
|
'rorm.DatabaseORM',
|
488
508
|
'rbuild.DatabaseBuild',
|
489
509
|
'rconfig.DatabaseConfig',
|
490
|
-
'
|
491
|
-
'
|
492
|
-
'
|
493
|
-
'
|
494
|
-
'
|
510
|
+
'rinfo.DatabaseInformationSchema',
|
511
|
+
'rinfo.DatabaseInformationParameterVariables',
|
512
|
+
'rinfo.DatabaseInformationParameterStatus',
|
513
|
+
'rinfo.DatabaseInformationParameterVariablesGlobal',
|
514
|
+
'rinfo.DatabaseInformationParameterStatusGlobal'
|
495
515
|
]
|
496
516
|
):
|
497
517
|
"""
|
@@ -507,11 +527,11 @@ class DatabaseAsync(
|
|
507
527
|
'rorm.DatabaseORMAsync',
|
508
528
|
'rbuild.DatabaseBuildAsync',
|
509
529
|
'rconfig.DatabaseConfigAsync',
|
510
|
-
'
|
511
|
-
'
|
512
|
-
'
|
513
|
-
'
|
514
|
-
'
|
530
|
+
'rinfo.DatabaseInformationSchemaAsync',
|
531
|
+
'rinfo.DatabaseInformationParameterVariablesAsync',
|
532
|
+
'rinfo.DatabaseInformationParameterStatusAsync',
|
533
|
+
'rinfo.DatabaseInformationParameterVariablesGlobalAsync',
|
534
|
+
'rinfo.DatabaseInformationParameterStatusGlobalAsync'
|
515
535
|
]
|
516
536
|
):
|
517
537
|
"""
|
reydb/rerror.py
CHANGED
@@ -36,8 +36,17 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
36
36
|
"""
|
37
37
|
Database error super type.
|
38
38
|
Can create database used `self.build_db` method.
|
39
|
+
|
40
|
+
Attributes
|
41
|
+
----------
|
42
|
+
db_names : Database table name mapping dictionary.
|
39
43
|
"""
|
40
44
|
|
45
|
+
db_names = {
|
46
|
+
'error': 'error',
|
47
|
+
'stats_error': 'stats_error'
|
48
|
+
}
|
49
|
+
|
41
50
|
|
42
51
|
def __init__(self, db: DatabaseT) -> None:
|
43
52
|
"""
|
@@ -50,10 +59,6 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
50
59
|
|
51
60
|
# Build.
|
52
61
|
self.db = db
|
53
|
-
self.db_names = {
|
54
|
-
'error': 'error',
|
55
|
-
'stats_error': 'stats_error'
|
56
|
-
}
|
57
62
|
|
58
63
|
|
59
64
|
def handle_build_db(self) -> None:
|
reydb/rexec.py
CHANGED
@@ -18,7 +18,7 @@ from reykit.rdata import FunctionGenerator
|
|
18
18
|
from reykit.rmonkey import monkey_sqlalchemy_result_more_fetch, monkey_sqlalchemy_row_index_field
|
19
19
|
from reykit.rrand import randn
|
20
20
|
from reykit.rre import findall
|
21
|
-
from reykit.rstdout import echo
|
21
|
+
from reykit.rstdout import echo as recho
|
22
22
|
from reykit.rtable import TableData, Table
|
23
23
|
from reykit.rtime import TimeMark, time_to
|
24
24
|
from reykit.rwrap import wrap_runtime
|
@@ -67,7 +67,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
67
67
|
self,
|
68
68
|
sql: str | TextClause,
|
69
69
|
data: TableData | None = None,
|
70
|
-
|
70
|
+
echo: bool | None = None,
|
71
71
|
**kwdata: Any
|
72
72
|
) -> tuple[TextClause, list[dict], bool]:
|
73
73
|
"""
|
@@ -77,8 +77,8 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
77
77
|
----------
|
78
78
|
sql : SQL in method `sqlalchemy.text` format, or `TextClause` object.
|
79
79
|
data : Data set for filling.
|
80
|
-
|
81
|
-
- `None`: Use attribute `Database.
|
80
|
+
echo : Whether report SQL execute information.
|
81
|
+
- `None`: Use attribute `Database.echo`.
|
82
82
|
- `bool`: Use this value.
|
83
83
|
kwdata : Keyword parameters for filling.
|
84
84
|
|
@@ -88,7 +88,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
88
88
|
"""
|
89
89
|
|
90
90
|
# Handle parameter.
|
91
|
-
|
91
|
+
echo = get_first_notnone(echo, self.conn.db.echo)
|
92
92
|
sql = handle_sql(sql)
|
93
93
|
if data is None:
|
94
94
|
if kwdata == {}:
|
@@ -102,7 +102,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
102
102
|
row.update(kwdata)
|
103
103
|
data = handle_data(data, sql)
|
104
104
|
|
105
|
-
return sql, data,
|
105
|
+
return sql, data, echo
|
106
106
|
|
107
107
|
|
108
108
|
def handle_select(
|
@@ -638,7 +638,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
638
638
|
self,
|
639
639
|
sql: str | TextClause,
|
640
640
|
data: TableData | None = None,
|
641
|
-
|
641
|
+
echo: bool | None = None,
|
642
642
|
**kwdata: Any
|
643
643
|
) -> Result:
|
644
644
|
"""
|
@@ -648,8 +648,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
648
648
|
----------
|
649
649
|
sql : SQL in method `sqlalchemy.text` format, or `TextClause` object.
|
650
650
|
data : Data set for filling.
|
651
|
-
|
652
|
-
- `None`: Use attribute `Database.
|
651
|
+
echo : Whether report SQL execute information.
|
652
|
+
- `None`: Use attribute `Database.echo`.
|
653
653
|
- `bool`: Use this value.
|
654
654
|
kwdata : Keyword parameters for filling.
|
655
655
|
|
@@ -659,7 +659,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
659
659
|
"""
|
660
660
|
|
661
661
|
# Handle parameter.
|
662
|
-
sql, data,
|
662
|
+
sql, data, echo = self.handle_execute(sql, data, echo, **kwdata)
|
663
663
|
|
664
664
|
# Transaction.
|
665
665
|
self.conn.get_begin()
|
@@ -667,7 +667,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
667
667
|
# Execute.
|
668
668
|
|
669
669
|
## Report.
|
670
|
-
if
|
670
|
+
if echo:
|
671
671
|
execute = wrap_runtime(self.conn.connection.execute, to_return=True, to_print=False)
|
672
672
|
result, report_runtime, *_ = execute(sql, data)
|
673
673
|
report_info = (
|
@@ -680,9 +680,9 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
680
680
|
if sql_part != ''
|
681
681
|
]
|
682
682
|
if data == []:
|
683
|
-
|
683
|
+
recho(report_info, *sqls, title='SQL')
|
684
684
|
else:
|
685
|
-
|
685
|
+
recho(report_info, *sqls, data, title='SQL')
|
686
686
|
|
687
687
|
## Not report.
|
688
688
|
else:
|
@@ -708,7 +708,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
708
708
|
having: str | None = None,
|
709
709
|
order: str | None = None,
|
710
710
|
limit: int | str | tuple[int, int] | None = None,
|
711
|
-
|
711
|
+
echo: bool | None = None,
|
712
712
|
**kwdata: Any
|
713
713
|
) -> Result:
|
714
714
|
"""
|
@@ -732,8 +732,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
732
732
|
limit : Clause `LIMIT` content.
|
733
733
|
- `int | str`: Join as `LIMIT int/str`.
|
734
734
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
735
|
-
|
736
|
-
- `None`: Use attribute `Database.
|
735
|
+
echo : Whether report SQL execute information.
|
736
|
+
- `None`: Use attribute `Database.echo`.
|
737
737
|
kwdata : Keyword parameters for filling.
|
738
738
|
|
739
739
|
Returns
|
@@ -759,7 +759,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
759
759
|
sql = self.handle_select(path, fields, where, group, having, order, limit)
|
760
760
|
|
761
761
|
# Execute SQL.
|
762
|
-
result = self.execute(sql,
|
762
|
+
result = self.execute(sql, echo=echo, **kwdata)
|
763
763
|
|
764
764
|
return result
|
765
765
|
|
@@ -769,7 +769,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
769
769
|
path: str | tuple[str, str],
|
770
770
|
data: TableData,
|
771
771
|
duplicate: Literal['ignore', 'update'] | Container[str] | None = None,
|
772
|
-
|
772
|
+
echo: bool | None = None,
|
773
773
|
**kwdata: Any
|
774
774
|
) -> Result:
|
775
775
|
"""
|
@@ -786,8 +786,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
786
786
|
- `ignore`: Use `UPDATE IGNORE INTO` clause.
|
787
787
|
- `update`: Use `ON DUPLICATE KEY UPDATE` clause and update all fields.
|
788
788
|
- `Container[str]`: Use `ON DUPLICATE KEY UPDATE` clause and update this fields.
|
789
|
-
|
790
|
-
- `None`: Use attribute `Database.
|
789
|
+
echo : Whether report SQL execute information.
|
790
|
+
- `None`: Use attribute `Database.echo`.
|
791
791
|
kwdata : Keyword parameters for filling.
|
792
792
|
- `str and first character is ':'`: Use this syntax.
|
793
793
|
- `Any`: Use this value.
|
@@ -812,7 +812,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
812
812
|
sql, kwdata = self.handle_insert(path, data, duplicate, **kwdata)
|
813
813
|
|
814
814
|
# Execute SQL.
|
815
|
-
result = self.execute(sql, data,
|
815
|
+
result = self.execute(sql, data, echo, **kwdata)
|
816
816
|
|
817
817
|
return result
|
818
818
|
|
@@ -822,7 +822,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
822
822
|
path: str | tuple[str, str],
|
823
823
|
data: TableData,
|
824
824
|
where_fields: str | Iterable[str] | None = None,
|
825
|
-
|
825
|
+
echo: bool | None = None,
|
826
826
|
**kwdata: Any
|
827
827
|
) -> Result:
|
828
828
|
"""
|
@@ -845,8 +845,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
845
845
|
- `None`: The first key value pair of each item is judged.
|
846
846
|
- `str`: This key value pair of each item is judged.
|
847
847
|
- `Iterable[str]`: Multiple judged, `and`: relationship.
|
848
|
-
|
849
|
-
- `None`: Use attribute `Database.
|
848
|
+
echo : Whether report SQL execute information.
|
849
|
+
- `None`: Use attribute `Database.echo`.
|
850
850
|
kwdata : Keyword parameters for filling.
|
851
851
|
- `str and first character is ':'`: Use this syntax.
|
852
852
|
- `Any`: Use this value.
|
@@ -871,7 +871,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
871
871
|
sql, data = self.handle_update(path, data, where_fields, **kwdata)
|
872
872
|
|
873
873
|
# Execute SQL.
|
874
|
-
result = self.execute(sql, data,
|
874
|
+
result = self.execute(sql, data, echo)
|
875
875
|
|
876
876
|
return result
|
877
877
|
|
@@ -882,7 +882,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
882
882
|
where: str | None = None,
|
883
883
|
order: str | None = None,
|
884
884
|
limit: int | str | None = None,
|
885
|
-
|
885
|
+
echo: bool | None = None,
|
886
886
|
**kwdata: Any
|
887
887
|
) -> Result:
|
888
888
|
"""
|
@@ -896,8 +896,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
896
896
|
where : Clause `WHERE` content, join as `WHERE str`.
|
897
897
|
order : Clause `ORDER BY` content, join as `ORDER BY str`.
|
898
898
|
limit : Clause `LIMIT` content, join as `LIMIT int/str`.
|
899
|
-
|
900
|
-
- `None`: Use attribute `Database.
|
899
|
+
echo : Whether report SQL execute information.
|
900
|
+
- `None`: Use attribute `Database.echo`.
|
901
901
|
kwdata : Keyword parameters for filling.
|
902
902
|
|
903
903
|
Returns
|
@@ -917,7 +917,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
917
917
|
sql = self.handle_delete(path, where, order, limit)
|
918
918
|
|
919
919
|
# Execute SQL.
|
920
|
-
result = self.execute(sql,
|
920
|
+
result = self.execute(sql, echo=echo, **kwdata)
|
921
921
|
|
922
922
|
return result
|
923
923
|
|
@@ -928,7 +928,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
928
928
|
fields: str | Iterable[str] | None = None,
|
929
929
|
where: str | None = None,
|
930
930
|
limit: int | str | tuple[int, int] | None = None,
|
931
|
-
|
931
|
+
echo: bool | None = None,
|
932
932
|
**kwdata: Any
|
933
933
|
) -> Result:
|
934
934
|
"""
|
@@ -947,6 +947,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
947
947
|
limit : Clause `LIMIT` content.
|
948
948
|
- `int | str`: Join as `LIMIT int/str`.
|
949
949
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
950
|
+
echo : Whether report SQL execute information.
|
951
|
+
- `None`: Use attribute `Database.echo`.
|
950
952
|
kwdata : Keyword parameters for filling.
|
951
953
|
|
952
954
|
Returns
|
@@ -966,7 +968,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
966
968
|
sql = self.handle_copy(path, fields, where, limit)
|
967
969
|
|
968
970
|
# Execute SQL.
|
969
|
-
result = self.execute(sql,
|
971
|
+
result = self.execute(sql, echo=echo, **kwdata)
|
970
972
|
|
971
973
|
return result
|
972
974
|
|
@@ -975,7 +977,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
975
977
|
self,
|
976
978
|
path: str | tuple[str, str],
|
977
979
|
where: str | None = None,
|
978
|
-
|
980
|
+
echo: bool | None = None,
|
979
981
|
**kwdata: Any
|
980
982
|
) -> int:
|
981
983
|
"""
|
@@ -989,8 +991,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
989
991
|
where : Match condition, `WHERE` clause content, join as `WHERE str`.
|
990
992
|
- `None`: Match all.
|
991
993
|
- `str`: Match condition.
|
992
|
-
|
993
|
-
- `None`: Use attribute `Database.
|
994
|
+
echo : Whether report SQL execute information.
|
995
|
+
- `None`: Use attribute `Database.echo`.
|
994
996
|
kwdata : Keyword parameters for filling.
|
995
997
|
|
996
998
|
Returns
|
@@ -1007,7 +1009,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1007
1009
|
"""
|
1008
1010
|
|
1009
1011
|
# Execute.
|
1010
|
-
result = self.select(path, '1', where=where,
|
1012
|
+
result = self.select(path, '1', where=where, echo=echo, **kwdata)
|
1011
1013
|
count = len(tuple(result))
|
1012
1014
|
|
1013
1015
|
return count
|
@@ -1017,7 +1019,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1017
1019
|
self,
|
1018
1020
|
path: str | tuple[str, str],
|
1019
1021
|
where: str | None = None,
|
1020
|
-
|
1022
|
+
echo: bool | None = None,
|
1021
1023
|
**kwdata: Any
|
1022
1024
|
) -> bool:
|
1023
1025
|
"""
|
@@ -1031,8 +1033,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1031
1033
|
where : Match condition, `WHERE` clause content, join as `WHERE str`.
|
1032
1034
|
- `None`: Match all.
|
1033
1035
|
- `str`: Match condition.
|
1034
|
-
|
1035
|
-
- `None`: Use attribute `Database.
|
1036
|
+
echo : Whether report SQL execute information.
|
1037
|
+
- `None`: Use attribute `Database.echo`.
|
1036
1038
|
kwdata : Keyword parameters for filling.
|
1037
1039
|
|
1038
1040
|
Returns
|
@@ -1051,7 +1053,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1051
1053
|
"""
|
1052
1054
|
|
1053
1055
|
# Execute.
|
1054
|
-
result = self.count(path, where,
|
1056
|
+
result = self.count(path, where, echo, **kwdata)
|
1055
1057
|
|
1056
1058
|
# Judge.
|
1057
1059
|
judge = result != 0
|
@@ -1063,7 +1065,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1063
1065
|
self,
|
1064
1066
|
sql: str | TextClause,
|
1065
1067
|
data: TableData,
|
1066
|
-
|
1068
|
+
echo: bool | None = None,
|
1067
1069
|
**kwdata: Any
|
1068
1070
|
) -> Generator[Result, Any, None]:
|
1069
1071
|
"""
|
@@ -1073,8 +1075,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1073
1075
|
----------
|
1074
1076
|
sql : SQL in method `sqlalchemy.text` format, or `TextClause` object.
|
1075
1077
|
data : Data set for filling.
|
1076
|
-
|
1077
|
-
- `None`: Use attribute `Database.
|
1078
|
+
echo : Whether report SQL execute information.
|
1079
|
+
- `None`: Use attribute `Database.echo`.
|
1078
1080
|
- `bool`: Use this value.
|
1079
1081
|
kwdata : Keyword parameters for filling.
|
1080
1082
|
|
@@ -1087,7 +1089,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1087
1089
|
func_generator = FunctionGenerator(
|
1088
1090
|
self.execute,
|
1089
1091
|
sql=sql,
|
1090
|
-
|
1092
|
+
echo=echo,
|
1091
1093
|
**kwdata
|
1092
1094
|
)
|
1093
1095
|
|
@@ -1102,24 +1104,24 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1102
1104
|
|
1103
1105
|
|
1104
1106
|
@overload
|
1105
|
-
def sleep(self,
|
1107
|
+
def sleep(self, echo: bool | None = None) -> int: ...
|
1106
1108
|
|
1107
1109
|
@overload
|
1108
|
-
def sleep(self, second: int,
|
1110
|
+
def sleep(self, second: int, echo: bool | None = None) -> int: ...
|
1109
1111
|
|
1110
1112
|
@overload
|
1111
|
-
def sleep(self, low: int = 0, high: int = 10,
|
1113
|
+
def sleep(self, low: int = 0, high: int = 10, echo: bool | None = None) -> int: ...
|
1112
1114
|
|
1113
1115
|
@overload
|
1114
|
-
def sleep(self, *thresholds: float,
|
1116
|
+
def sleep(self, *thresholds: float, echo: bool | None = None) -> float: ...
|
1115
1117
|
|
1116
1118
|
@overload
|
1117
|
-
def sleep(self, *thresholds: float, precision: Literal[0],
|
1119
|
+
def sleep(self, *thresholds: float, precision: Literal[0], echo: bool | None = None) -> int: ...
|
1118
1120
|
|
1119
1121
|
@overload
|
1120
|
-
def sleep(self, *thresholds: float, precision: int,
|
1122
|
+
def sleep(self, *thresholds: float, precision: int, echo: bool | None = None) -> float: ...
|
1121
1123
|
|
1122
|
-
def sleep(self, *thresholds: float, precision: int | None = None,
|
1124
|
+
def sleep(self, *thresholds: float, precision: int | None = None, echo: bool | None = None) -> float:
|
1123
1125
|
"""
|
1124
1126
|
Let the database wait random seconds.
|
1125
1127
|
|
@@ -1132,8 +1134,8 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1132
1134
|
precision : Precision of random range, that is maximum decimal digits of return value.
|
1133
1135
|
- `None`: Set to Maximum decimal digits of element of parameter `thresholds`.
|
1134
1136
|
- `int`: Set to this value.
|
1135
|
-
|
1136
|
-
- `None`: Use attribute `Database.
|
1137
|
+
echo : Whether report SQL execute information.
|
1138
|
+
- `None`: Use attribute `Database.echo`.
|
1137
1139
|
- `bool`: Use this value.
|
1138
1140
|
|
1139
1141
|
Returns
|
@@ -1151,7 +1153,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1151
1153
|
|
1152
1154
|
# Sleep.
|
1153
1155
|
sql = f'SELECT SLEEP({second})'
|
1154
|
-
self.execute(sql,
|
1156
|
+
self.execute(sql, echo=echo)
|
1155
1157
|
|
1156
1158
|
return second
|
1157
1159
|
|
@@ -1166,7 +1168,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1166
1168
|
self,
|
1167
1169
|
sql: str | TextClause,
|
1168
1170
|
data: TableData | None = None,
|
1169
|
-
|
1171
|
+
echo: bool | None = None,
|
1170
1172
|
**kwdata: Any
|
1171
1173
|
) -> Result:
|
1172
1174
|
"""
|
@@ -1176,9 +1178,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1176
1178
|
----------
|
1177
1179
|
sql : SQL in method `sqlalchemy.text` format, or `TextClause` object.
|
1178
1180
|
data : Data set for filling.
|
1179
|
-
|
1180
|
-
- `None`: Use attribute `
|
1181
|
-
- `bool`: Use this value.
|
1181
|
+
echo : Whether report SQL execute information.
|
1182
|
+
- `None`: Use attribute `Database.echo`.
|
1182
1183
|
kwdata : Keyword parameters for filling.
|
1183
1184
|
|
1184
1185
|
Returns
|
@@ -1187,7 +1188,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1187
1188
|
"""
|
1188
1189
|
|
1189
1190
|
# Handle parameter.
|
1190
|
-
sql, data,
|
1191
|
+
sql, data, echo = self.handle_execute(sql, data, echo, **kwdata)
|
1191
1192
|
|
1192
1193
|
# Transaction.
|
1193
1194
|
await self.conn.get_begin()
|
@@ -1195,7 +1196,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1195
1196
|
# Execute.
|
1196
1197
|
|
1197
1198
|
## Report.
|
1198
|
-
if
|
1199
|
+
if echo:
|
1199
1200
|
tm = TimeMark()
|
1200
1201
|
tm()
|
1201
1202
|
result = await self.conn.connection.execute(sql, data)
|
@@ -1224,9 +1225,9 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1224
1225
|
]
|
1225
1226
|
|
1226
1227
|
if data == []:
|
1227
|
-
|
1228
|
+
recho(report_info, *sqls, title='SQL')
|
1228
1229
|
else:
|
1229
|
-
|
1230
|
+
recho(report_info, *sqls, data, title='SQL')
|
1230
1231
|
|
1231
1232
|
## Not report.
|
1232
1233
|
else:
|
@@ -1253,7 +1254,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1253
1254
|
having: str | None = None,
|
1254
1255
|
order: str | None = None,
|
1255
1256
|
limit: int | str | tuple[int, int] | None = None,
|
1256
|
-
|
1257
|
+
echo: bool | None = None,
|
1257
1258
|
**kwdata: Any
|
1258
1259
|
) -> Result:
|
1259
1260
|
"""
|
@@ -1277,8 +1278,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1277
1278
|
limit : Clause `LIMIT` content.
|
1278
1279
|
- `int | str`: Join as `LIMIT int/str`.
|
1279
1280
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
1280
|
-
|
1281
|
-
- `None`: Use attribute `Database.
|
1281
|
+
echo : Whether report SQL execute information.
|
1282
|
+
- `None`: Use attribute `Database.echo`.
|
1282
1283
|
kwdata : Keyword parameters for filling.
|
1283
1284
|
|
1284
1285
|
Returns
|
@@ -1304,7 +1305,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1304
1305
|
sql = self.handle_select(path, fields, where, group, having, order, limit)
|
1305
1306
|
|
1306
1307
|
# Execute SQL.
|
1307
|
-
result = await self.execute(sql,
|
1308
|
+
result = await self.execute(sql, echo=echo, **kwdata)
|
1308
1309
|
|
1309
1310
|
return result
|
1310
1311
|
|
@@ -1314,7 +1315,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1314
1315
|
path: str | tuple[str, str],
|
1315
1316
|
data: TableData,
|
1316
1317
|
duplicate: Literal['ignore', 'update'] | Container[str] | None = None,
|
1317
|
-
|
1318
|
+
echo: bool | None = None,
|
1318
1319
|
**kwdata: Any
|
1319
1320
|
) -> Result:
|
1320
1321
|
"""
|
@@ -1331,8 +1332,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1331
1332
|
- `ignore`: Use `UPDATE IGNORE INTO` clause.
|
1332
1333
|
- `update`: Use `ON DUPLICATE KEY UPDATE` clause and update all fields.
|
1333
1334
|
- `Container[str]`: Use `ON DUPLICATE KEY UPDATE` clause and update this fields.
|
1334
|
-
|
1335
|
-
- `None`: Use attribute `Database.
|
1335
|
+
echo : Whether report SQL execute information.
|
1336
|
+
- `None`: Use attribute `Database.echo`.
|
1336
1337
|
kwdata : Keyword parameters for filling.
|
1337
1338
|
- `str and first character is ':'`: Use this syntax.
|
1338
1339
|
- `Any`: Use this value.
|
@@ -1357,7 +1358,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1357
1358
|
sql, kwdata = self.handle_insert(path, data, duplicate, **kwdata)
|
1358
1359
|
|
1359
1360
|
# Execute SQL.
|
1360
|
-
result = await self.execute(sql, data,
|
1361
|
+
result = await self.execute(sql, data, echo, **kwdata)
|
1361
1362
|
|
1362
1363
|
return result
|
1363
1364
|
|
@@ -1367,7 +1368,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1367
1368
|
path: str | tuple[str, str],
|
1368
1369
|
data: TableData,
|
1369
1370
|
where_fields: str | Iterable[str] | None = None,
|
1370
|
-
|
1371
|
+
echo: bool | None = None,
|
1371
1372
|
**kwdata: Any
|
1372
1373
|
) -> Result:
|
1373
1374
|
"""
|
@@ -1390,8 +1391,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1390
1391
|
- `None`: The first key value pair of each item is judged.
|
1391
1392
|
- `str`: This key value pair of each item is judged.
|
1392
1393
|
- `Iterable[str]`: Multiple judged, `and`: relationship.
|
1393
|
-
|
1394
|
-
- `None`: Use attribute `Database.
|
1394
|
+
echo : Whether report SQL execute information.
|
1395
|
+
- `None`: Use attribute `Database.echo`.
|
1395
1396
|
kwdata : Keyword parameters for filling.
|
1396
1397
|
- `str and first character is ':'`: Use this syntax.
|
1397
1398
|
- `Any`: Use this value.
|
@@ -1416,7 +1417,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1416
1417
|
sql, data = self.handle_update(path, data, where_fields, **kwdata)
|
1417
1418
|
|
1418
1419
|
# Execute SQL.
|
1419
|
-
result = await self.execute(sql, data,
|
1420
|
+
result = await self.execute(sql, data, echo)
|
1420
1421
|
|
1421
1422
|
return result
|
1422
1423
|
|
@@ -1427,7 +1428,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1427
1428
|
where: str | None = None,
|
1428
1429
|
order: str | None = None,
|
1429
1430
|
limit: int | str | None = None,
|
1430
|
-
|
1431
|
+
echo: bool | None = None,
|
1431
1432
|
**kwdata: Any
|
1432
1433
|
) -> Result:
|
1433
1434
|
"""
|
@@ -1441,8 +1442,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1441
1442
|
where : Clause `WHERE` content, join as `WHERE str`.
|
1442
1443
|
order : Clause `ORDER BY` content, join as `ORDER BY str`.
|
1443
1444
|
limit : Clause `LIMIT` content, join as `LIMIT int/str`.
|
1444
|
-
|
1445
|
-
- `None`: Use attribute `Database.
|
1445
|
+
echo : Whether report SQL execute information.
|
1446
|
+
- `None`: Use attribute `Database.echo`.
|
1446
1447
|
kwdata : Keyword parameters for filling.
|
1447
1448
|
|
1448
1449
|
Returns
|
@@ -1462,7 +1463,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1462
1463
|
sql = self.handle_delete(path, where, order, limit)
|
1463
1464
|
|
1464
1465
|
# Execute SQL.
|
1465
|
-
result = await self.execute(sql,
|
1466
|
+
result = await self.execute(sql, echo=echo, **kwdata)
|
1466
1467
|
|
1467
1468
|
return result
|
1468
1469
|
|
@@ -1473,7 +1474,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1473
1474
|
fields: str | Iterable[str] | None = None,
|
1474
1475
|
where: str | None = None,
|
1475
1476
|
limit: int | str | tuple[int, int] | None = None,
|
1476
|
-
|
1477
|
+
echo: bool | None = None,
|
1477
1478
|
**kwdata: Any
|
1478
1479
|
) -> Result:
|
1479
1480
|
"""
|
@@ -1492,6 +1493,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1492
1493
|
limit : Clause `LIMIT` content.
|
1493
1494
|
- `int | str`: Join as `LIMIT int/str`.
|
1494
1495
|
- `tuple[int, int]`: Join as `LIMIT int, int`.
|
1496
|
+
echo : Whether report SQL execute information.
|
1497
|
+
- `None`: Use attribute `Database.echo`.
|
1495
1498
|
kwdata : Keyword parameters for filling.
|
1496
1499
|
|
1497
1500
|
Returns
|
@@ -1511,7 +1514,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1511
1514
|
sql = self.handle_copy(path, fields, where, limit)
|
1512
1515
|
|
1513
1516
|
# Execute SQL.
|
1514
|
-
result = await self.execute(sql,
|
1517
|
+
result = await self.execute(sql, echo=echo, **kwdata)
|
1515
1518
|
|
1516
1519
|
return result
|
1517
1520
|
|
@@ -1520,7 +1523,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1520
1523
|
self,
|
1521
1524
|
path: str | tuple[str, str],
|
1522
1525
|
where: str | None = None,
|
1523
|
-
|
1526
|
+
echo: bool | None = None,
|
1524
1527
|
**kwdata: Any
|
1525
1528
|
) -> int:
|
1526
1529
|
"""
|
@@ -1534,8 +1537,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1534
1537
|
where : Match condition, `WHERE` clause content, join as `WHERE str`.
|
1535
1538
|
- `None`: Match all.
|
1536
1539
|
- `str`: Match condition.
|
1537
|
-
|
1538
|
-
- `None`: Use attribute `Database.
|
1540
|
+
echo : Whether report SQL execute information.
|
1541
|
+
- `None`: Use attribute `Database.echo`.
|
1539
1542
|
kwdata : Keyword parameters for filling.
|
1540
1543
|
|
1541
1544
|
Returns
|
@@ -1552,7 +1555,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1552
1555
|
"""
|
1553
1556
|
|
1554
1557
|
# Execute.
|
1555
|
-
result = await self.select(path, '1', where=where,
|
1558
|
+
result = await self.select(path, '1', where=where, echo=echo, **kwdata)
|
1556
1559
|
count = len(tuple(result))
|
1557
1560
|
|
1558
1561
|
return count
|
@@ -1562,7 +1565,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1562
1565
|
self,
|
1563
1566
|
path: str | tuple[str, str],
|
1564
1567
|
where: str | None = None,
|
1565
|
-
|
1568
|
+
echo: bool | None = None,
|
1566
1569
|
**kwdata: Any
|
1567
1570
|
) -> bool:
|
1568
1571
|
"""
|
@@ -1576,8 +1579,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1576
1579
|
where : Match condition, `WHERE` clause content, join as `WHERE str`.
|
1577
1580
|
- `None`: Match all.
|
1578
1581
|
- `str`: Match condition.
|
1579
|
-
|
1580
|
-
- `None`: Use attribute `Database.
|
1582
|
+
echo : Whether report SQL execute information.
|
1583
|
+
- `None`: Use attribute `Database.echo`.
|
1581
1584
|
kwdata : Keyword parameters for filling.
|
1582
1585
|
|
1583
1586
|
Returns
|
@@ -1596,7 +1599,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1596
1599
|
"""
|
1597
1600
|
|
1598
1601
|
# Execute.
|
1599
|
-
result = await self.count(path, where,
|
1602
|
+
result = await self.count(path, where, echo, **kwdata)
|
1600
1603
|
|
1601
1604
|
# Judge.
|
1602
1605
|
judge = result != 0
|
@@ -1608,7 +1611,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1608
1611
|
self,
|
1609
1612
|
sql: str | TextClause,
|
1610
1613
|
data: TableData,
|
1611
|
-
|
1614
|
+
echo: bool | None = None,
|
1612
1615
|
**kwdata: Any
|
1613
1616
|
) -> AsyncGenerator[Result, Any]:
|
1614
1617
|
"""
|
@@ -1618,9 +1621,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1618
1621
|
----------
|
1619
1622
|
sql : SQL in method `sqlalchemy.text` format, or `TextClause` object.
|
1620
1623
|
data : Data set for filling.
|
1621
|
-
|
1622
|
-
- `None`: Use attribute `
|
1623
|
-
- `bool`: Use this value.
|
1624
|
+
echo : Whether report SQL execute information.
|
1625
|
+
- `None`: Use attribute `Database.echo`.
|
1624
1626
|
kwdata : Keyword parameters for filling.
|
1625
1627
|
|
1626
1628
|
Returns
|
@@ -1632,7 +1634,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1632
1634
|
func_generator = FunctionGenerator(
|
1633
1635
|
self.execute,
|
1634
1636
|
sql=sql,
|
1635
|
-
|
1637
|
+
echo=echo,
|
1636
1638
|
**kwdata
|
1637
1639
|
)
|
1638
1640
|
|
@@ -1647,24 +1649,24 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1647
1649
|
|
1648
1650
|
|
1649
1651
|
@overload
|
1650
|
-
async def sleep(self,
|
1652
|
+
async def sleep(self, echo: bool | None = None) -> int: ...
|
1651
1653
|
|
1652
1654
|
@overload
|
1653
|
-
async def sleep(self, second: int,
|
1655
|
+
async def sleep(self, second: int, echo: bool | None = None) -> int: ...
|
1654
1656
|
|
1655
1657
|
@overload
|
1656
|
-
async def sleep(self, low: int = 0, high: int = 10,
|
1658
|
+
async def sleep(self, low: int = 0, high: int = 10, echo: bool | None = None) -> int: ...
|
1657
1659
|
|
1658
1660
|
@overload
|
1659
|
-
async def sleep(self, *thresholds: float,
|
1661
|
+
async def sleep(self, *thresholds: float, echo: bool | None = None) -> float: ...
|
1660
1662
|
|
1661
1663
|
@overload
|
1662
|
-
async def sleep(self, *thresholds: float, precision: Literal[0],
|
1664
|
+
async def sleep(self, *thresholds: float, precision: Literal[0], echo: bool | None = None) -> int: ...
|
1663
1665
|
|
1664
1666
|
@overload
|
1665
|
-
async def sleep(self, *thresholds: float, precision: int,
|
1667
|
+
async def sleep(self, *thresholds: float, precision: int, echo: bool | None = None) -> float: ...
|
1666
1668
|
|
1667
|
-
async def sleep(self, *thresholds: float, precision: int | None = None,
|
1669
|
+
async def sleep(self, *thresholds: float, precision: int | None = None, echo: bool | None = None) -> float:
|
1668
1670
|
"""
|
1669
1671
|
Asynchronous let the database wait random seconds.
|
1670
1672
|
|
@@ -1677,9 +1679,8 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1677
1679
|
precision : Precision of random range, that is maximum decimal digits of return value.
|
1678
1680
|
- `None`: Set to Maximum decimal digits of element of parameter `thresholds`.
|
1679
1681
|
- `int`: Set to this value.
|
1680
|
-
|
1681
|
-
- `None`: Use attribute `
|
1682
|
-
- `bool`: Use this value.
|
1682
|
+
echo : Whether report SQL execute information.
|
1683
|
+
- `None`: Use attribute `Database.echo`.
|
1683
1684
|
|
1684
1685
|
Returns
|
1685
1686
|
-------
|
@@ -1696,6 +1697,6 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1696
1697
|
|
1697
1698
|
# Sleep.
|
1698
1699
|
sql = f'SELECT SLEEP({second})'
|
1699
|
-
await self.execute(sql,
|
1700
|
+
await self.execute(sql, echo=echo)
|
1700
1701
|
|
1701
1702
|
return second
|
reydb/{rparam.py → rinfo.py}
RENAMED
@@ -5,7 +5,7 @@
|
|
5
5
|
@Time : 2022-12-05 14:10:02
|
6
6
|
@Author : Rey
|
7
7
|
@Contact : reyxbo@163.com
|
8
|
-
@Explain : Database
|
8
|
+
@Explain : Database information methods.
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
@@ -17,29 +17,36 @@ from .rexec import Result
|
|
17
17
|
|
18
18
|
|
19
19
|
__all__ = (
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
23
|
-
'
|
24
|
-
'
|
25
|
-
'
|
26
|
-
'
|
27
|
-
'
|
28
|
-
'
|
29
|
-
'
|
30
|
-
'
|
31
|
-
'
|
32
|
-
'
|
33
|
-
'
|
20
|
+
'DatabaseInformationBase',
|
21
|
+
'DatabaseInformationSchemaSuper',
|
22
|
+
'DatabaseInformationSchema',
|
23
|
+
'DatabaseInformationSchemaAsync',
|
24
|
+
'DatabaseInformationParameterSuper',
|
25
|
+
'DatabaseInformationParameter',
|
26
|
+
'DatabaseInformationParameterAsync',
|
27
|
+
'DatabaseInformationParameterVariables',
|
28
|
+
'DatabaseInformationParameterStatus',
|
29
|
+
'DatabaseInformationParameterVariablesGlobal',
|
30
|
+
'DatabaseInformationParameterStatusGlobal',
|
31
|
+
'DatabaseInformationParameterVariablesAsync',
|
32
|
+
'DatabaseInformationParameterStatusAsync',
|
33
|
+
'DatabaseInformationParameterVariablesGlobalAsync',
|
34
|
+
'DatabaseInformationParameterStatusGlobalAsync'
|
34
35
|
)
|
35
36
|
|
36
37
|
|
37
38
|
DatabaseT = TypeVar('DatabaseT', 'rdb.Database', 'rdb.DatabaseAsync')
|
38
39
|
|
39
40
|
|
40
|
-
class
|
41
|
+
class DatabaseInformationBase(DatabaseBase):
|
41
42
|
"""
|
42
|
-
Database
|
43
|
+
Database information base type.
|
44
|
+
"""
|
45
|
+
|
46
|
+
|
47
|
+
class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseT]):
|
48
|
+
"""
|
49
|
+
Database information schema super type.
|
43
50
|
"""
|
44
51
|
|
45
52
|
|
@@ -207,9 +214,9 @@ class DatabaseSchemaSuper(DatabaseBase, Generic[DatabaseT]):
|
|
207
214
|
return judge
|
208
215
|
|
209
216
|
|
210
|
-
class
|
217
|
+
class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rdb.Database']):
|
211
218
|
"""
|
212
|
-
Database schema type.
|
219
|
+
Database information schema type.
|
213
220
|
"""
|
214
221
|
|
215
222
|
|
@@ -306,9 +313,9 @@ class DatabaseSchema(DatabaseSchemaSuper['rdb.Database']):
|
|
306
313
|
return result
|
307
314
|
|
308
315
|
|
309
|
-
class
|
316
|
+
class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rdb.DatabaseAsync']):
|
310
317
|
"""
|
311
|
-
Asynchronous database schema type.
|
318
|
+
Asynchronous database information schema type.
|
312
319
|
"""
|
313
320
|
|
314
321
|
|
@@ -403,9 +410,9 @@ class DatabaseSchemaAsync(DatabaseSchemaSuper['rdb.DatabaseAsync']):
|
|
403
410
|
return result
|
404
411
|
|
405
412
|
|
406
|
-
class
|
413
|
+
class DatabaseInformationParameterSuper(DatabaseInformationBase, Generic[DatabaseT]):
|
407
414
|
"""
|
408
|
-
Database parameters super type.
|
415
|
+
Database information parameters super type.
|
409
416
|
"""
|
410
417
|
|
411
418
|
mode: Literal['VARIABLES', 'STATUS']
|
@@ -428,9 +435,9 @@ class DatabaseParametersSuper(DatabaseBase, Generic[DatabaseT]):
|
|
428
435
|
self.db = db
|
429
436
|
|
430
437
|
|
431
|
-
class
|
438
|
+
class DatabaseInformationParameter(DatabaseInformationParameterSuper['rdb.Database']):
|
432
439
|
"""
|
433
|
-
Database parameters type.
|
440
|
+
Database information parameters type.
|
434
441
|
"""
|
435
442
|
|
436
443
|
|
@@ -550,9 +557,9 @@ class DatabaseParameters(DatabaseParametersSuper['rdb.Database']):
|
|
550
557
|
self.db.execute(sql)
|
551
558
|
|
552
559
|
|
553
|
-
class
|
560
|
+
class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.DatabaseAsync']):
|
554
561
|
"""
|
555
|
-
Asynchrouous database parameters type.
|
562
|
+
Asynchrouous database information parameters type.
|
556
563
|
"""
|
557
564
|
|
558
565
|
|
@@ -676,72 +683,72 @@ class DatabaseParametersAsync(DatabaseParametersSuper['rdb.DatabaseAsync']):
|
|
676
683
|
await self.db.execute(sql)
|
677
684
|
|
678
685
|
|
679
|
-
class
|
686
|
+
class DatabaseInformationParameterVariables(DatabaseInformationParameter):
|
680
687
|
"""
|
681
|
-
Database variable parameters type.
|
688
|
+
Database information variable parameters type.
|
682
689
|
"""
|
683
690
|
|
684
691
|
mode: Final = 'VARIABLES'
|
685
692
|
glob: Final = False
|
686
693
|
|
687
694
|
|
688
|
-
class
|
695
|
+
class DatabaseInformationParameterStatus(DatabaseInformationParameter):
|
689
696
|
"""
|
690
|
-
Database status parameters type.
|
697
|
+
Database information status parameters type.
|
691
698
|
"""
|
692
699
|
|
693
700
|
mode: Final = 'STATUS'
|
694
701
|
glob: Final = False
|
695
702
|
|
696
703
|
|
697
|
-
class
|
704
|
+
class DatabaseInformationParameterVariablesGlobal(DatabaseInformationParameter):
|
698
705
|
"""
|
699
|
-
Database global variable parameters type.
|
706
|
+
Database information global variable parameters type.
|
700
707
|
"""
|
701
708
|
|
702
709
|
mode: Final = 'VARIABLES'
|
703
710
|
glob: Final = True
|
704
711
|
|
705
712
|
|
706
|
-
class
|
713
|
+
class DatabaseInformationParameterStatusGlobal(DatabaseInformationParameter):
|
707
714
|
"""
|
708
|
-
Database global status parameters type.
|
715
|
+
Database information global status parameters type.
|
709
716
|
"""
|
710
717
|
|
711
718
|
mode: Final = 'STATUS'
|
712
719
|
glob: Final = True
|
713
720
|
|
714
721
|
|
715
|
-
class
|
722
|
+
class DatabaseInformationParameterVariablesAsync(DatabaseInformationParameterAsync):
|
716
723
|
"""
|
717
|
-
Asynchrouous database variable parameters type.
|
724
|
+
Asynchrouous database information variable parameters type.
|
718
725
|
"""
|
719
726
|
|
720
727
|
mode: Final = 'VARIABLES'
|
721
728
|
glob: Final = False
|
722
729
|
|
723
730
|
|
724
|
-
class
|
731
|
+
class DatabaseInformationParameterStatusAsync(DatabaseInformationParameterAsync):
|
725
732
|
"""
|
726
|
-
Asynchrouous database status parameters type.
|
733
|
+
Asynchrouous database information status parameters type.
|
727
734
|
"""
|
728
735
|
|
729
736
|
mode: Final = 'STATUS'
|
730
737
|
glob: Final = False
|
731
738
|
|
732
739
|
|
733
|
-
class
|
740
|
+
class DatabaseInformationParameterVariablesGlobalAsync(DatabaseInformationParameterAsync):
|
734
741
|
"""
|
735
|
-
Asynchrouous database global variable parameters type.
|
742
|
+
Asynchrouous database information global variable parameters type.
|
736
743
|
"""
|
737
744
|
|
738
745
|
mode: Final = 'VARIABLES'
|
739
746
|
glob: Final = True
|
740
747
|
|
741
748
|
|
742
|
-
class
|
749
|
+
class DatabaseInformationParameterStatusGlobalAsync(DatabaseInformationParameterAsync):
|
743
750
|
"""
|
744
|
-
Asynchrouous database global status parameters type.
|
751
|
+
Asynchrouous database information global status parameters type.
|
745
752
|
"""
|
746
753
|
|
747
754
|
mode: Final = 'STATUS'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
reydb/__init__.py,sha256=4mnlkfJfkBfxBpCotVUJ86f4AnT8plqlFbGiH3vZ4PM,550
|
2
|
+
reydb/rall.py,sha256=IxSPGh77xz7ndDC7J8kZ_66Gq_xTAztGtnELUku1Ouw,364
|
3
|
+
reydb/rbase.py,sha256=0QGHxbdrcyDTY6BK7zMCTM9cRDkZyVNlL7S1j7A4Zp0,8260
|
4
|
+
reydb/rbuild.py,sha256=R_WQNpp67oHZFZlRuui_vaZAlJL4s_y5NX0gJXZY1yA,40320
|
5
|
+
reydb/rconfig.py,sha256=nZY2c6KTKWJuHXim1zEcPrIkMgqhiKb_lQQpVc-fpw8,19033
|
6
|
+
reydb/rconn.py,sha256=guRaR8N6RuzZzujwaeq7HhKWTizF9SrUBqEAFjfjpoo,6909
|
7
|
+
reydb/rdb.py,sha256=_K8_6_D7ptU8vrmPtijAeH8xCechwBXtCAusziyhxbU,14370
|
8
|
+
reydb/rerror.py,sha256=oTICXpVVtkH-u1N8pHs0f4krb1jbNU_FmcFCEHoO4yo,14852
|
9
|
+
reydb/rexec.py,sha256=XOx8JH4ApzCjXOuMplVQZQ5MCtf6UJXKGq98t-WRoFo,53102
|
10
|
+
reydb/rinfo.py,sha256=yeIZ9VmqBZtCM1Upzntal2aP7GtO0g4YsDW5LLMNOcg,18180
|
11
|
+
reydb/rorm.py,sha256=IipUvaFnS0gfHxzYkNSuM60skYsIGNBA9DvD8DnTpCc,40885
|
12
|
+
reydb-1.2.1.dist-info/METADATA,sha256=NFcX8OYkzXkDwi_NyV1uzNIqtA0kOHO-EITgjyAzJp8,1621
|
13
|
+
reydb-1.2.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
+
reydb-1.2.1.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
+
reydb-1.2.1.dist-info/RECORD,,
|
reydb-1.2.0.dist-info/RECORD
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
reydb/__init__.py,sha256=G2U0uiNjk2koYxIZjf9zvHoiQFO485XMnfQBMYSUdRc,549
|
2
|
-
reydb/rall.py,sha256=sOeiVXSIo2voFiiZaRx8h7_wWrx8fFjXkRQRSYHQccA,365
|
3
|
-
reydb/rbase.py,sha256=0QGHxbdrcyDTY6BK7zMCTM9cRDkZyVNlL7S1j7A4Zp0,8260
|
4
|
-
reydb/rbuild.py,sha256=R_WQNpp67oHZFZlRuui_vaZAlJL4s_y5NX0gJXZY1yA,40320
|
5
|
-
reydb/rconfig.py,sha256=mVRrkWa35stM5_sB0rD7VtgqLkVDv0BDnV_u2AGh0kI,18962
|
6
|
-
reydb/rconn.py,sha256=guRaR8N6RuzZzujwaeq7HhKWTizF9SrUBqEAFjfjpoo,6909
|
7
|
-
reydb/rdb.py,sha256=QB9het4tAPnJo4urWJ4oePI1g1avNI8O1P0-VPJLDEo,13809
|
8
|
-
reydb/rerror.py,sha256=LlEmKREe88QKLU3xf4mF88nXnGSQodrUruQAm9ifUeQ,14781
|
9
|
-
reydb/rexec.py,sha256=NLSvwwFhf60OndW3pjffzyMbWcLykhTbBbfI1YSueQ8,53223
|
10
|
-
reydb/rorm.py,sha256=IipUvaFnS0gfHxzYkNSuM60skYsIGNBA9DvD8DnTpCc,40885
|
11
|
-
reydb/rparam.py,sha256=S32dAKrCM0c4Qm-fhZkIRRhshsK1MmI12NgavNBfvJg,17443
|
12
|
-
reydb-1.2.0.dist-info/METADATA,sha256=0wocK72W-r7ZRvnaiZ4JFfJ9RLVCkXs2u6yrx1foDFw,1621
|
13
|
-
reydb-1.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
-
reydb-1.2.0.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
-
reydb-1.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|