reydb 1.2.15__py3-none-any.whl → 1.2.17__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/rbase.py +4 -4
- reydb/rbuild.py +26 -26
- reydb/rconfig.py +31 -40
- reydb/rdb.py +2 -2
- reydb/rerror.py +27 -36
- reydb/rexec.py +20 -20
- reydb/rinfo.py +15 -15
- reydb/rorm.py +21 -21
- {reydb-1.2.15.dist-info → reydb-1.2.17.dist-info}/METADATA +3 -3
- reydb-1.2.17.dist-info/RECORD +15 -0
- reydb-1.2.15.dist-info/RECORD +0 -15
- {reydb-1.2.15.dist-info → reydb-1.2.17.dist-info}/WHEEL +0 -0
- {reydb-1.2.15.dist-info → reydb-1.2.17.dist-info}/licenses/LICENSE +0 -0
reydb/__init__.py
CHANGED
reydb/rbase.py
CHANGED
@@ -75,7 +75,7 @@ def handle_sql(sql: str | TextClause) -> TextClause:
|
|
75
75
|
TextClause instance.
|
76
76
|
"""
|
77
77
|
|
78
|
-
#
|
78
|
+
# Parameter.
|
79
79
|
if type(sql) == TextClause:
|
80
80
|
sql = sql.text
|
81
81
|
|
@@ -102,7 +102,7 @@ def handle_data(data: list[dict], sql: str | TextClause) -> list[dict]:
|
|
102
102
|
Filled data.
|
103
103
|
"""
|
104
104
|
|
105
|
-
#
|
105
|
+
# Parameter.
|
106
106
|
if type(sql) == TextClause:
|
107
107
|
sql = sql.text
|
108
108
|
|
@@ -298,7 +298,7 @@ def get_syntax(self, sql: str | TextClause) -> list[str]:
|
|
298
298
|
SQL syntax type for each segment.
|
299
299
|
"""
|
300
300
|
|
301
|
-
#
|
301
|
+
# Parameter.
|
302
302
|
if type(sql) == TextClause:
|
303
303
|
sql = sql.text
|
304
304
|
|
@@ -325,7 +325,7 @@ def is_multi_sql(self, sql: str | TextClause) -> bool:
|
|
325
325
|
Judgment result.
|
326
326
|
"""
|
327
327
|
|
328
|
-
#
|
328
|
+
# Parameter.
|
329
329
|
if type(sql) == TextClause:
|
330
330
|
sql = sql.text
|
331
331
|
|
reydb/rbuild.py
CHANGED
@@ -122,7 +122,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
122
122
|
Field set SQL.
|
123
123
|
"""
|
124
124
|
|
125
|
-
#
|
125
|
+
# Parameter.
|
126
126
|
|
127
127
|
## Constraint.
|
128
128
|
constraint = ' ' + constraint
|
@@ -176,7 +176,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
176
176
|
Index set SQL.
|
177
177
|
"""
|
178
178
|
|
179
|
-
#
|
179
|
+
# Parameter.
|
180
180
|
if fields.__class__ == str:
|
181
181
|
fields = [fields]
|
182
182
|
match type_:
|
@@ -276,7 +276,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
276
276
|
SQL.
|
277
277
|
"""
|
278
278
|
|
279
|
-
#
|
279
|
+
# Parameter.
|
280
280
|
if type(path) == str:
|
281
281
|
database, table = self.db.database, path
|
282
282
|
else:
|
@@ -364,7 +364,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
364
364
|
SQL.
|
365
365
|
"""
|
366
366
|
|
367
|
-
#
|
367
|
+
# Parameter.
|
368
368
|
if type(path) == str:
|
369
369
|
database, table = self.db.database, path
|
370
370
|
else:
|
@@ -479,7 +479,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
479
479
|
SQL.
|
480
480
|
"""
|
481
481
|
|
482
|
-
#
|
482
|
+
# Parameter.
|
483
483
|
if type(path) == str:
|
484
484
|
database, table = self.db.database, path
|
485
485
|
else:
|
@@ -510,7 +510,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
510
510
|
SQL.
|
511
511
|
"""
|
512
512
|
|
513
|
-
#
|
513
|
+
# Parameter.
|
514
514
|
if type(path) == str:
|
515
515
|
database, table = self.db.database, path
|
516
516
|
else:
|
@@ -617,7 +617,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
617
617
|
SQL.
|
618
618
|
"""
|
619
619
|
|
620
|
-
#
|
620
|
+
# Parameter.
|
621
621
|
if type(path) == str:
|
622
622
|
database, table = self.db.database, path
|
623
623
|
else:
|
@@ -705,7 +705,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
705
705
|
SQL.
|
706
706
|
"""
|
707
707
|
|
708
|
-
#
|
708
|
+
# Parameter.
|
709
709
|
if type(path) == str:
|
710
710
|
database, table = self.db.database, path
|
711
711
|
else:
|
@@ -793,7 +793,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
793
793
|
SQL.
|
794
794
|
"""
|
795
795
|
|
796
|
-
#
|
796
|
+
# Parameter.
|
797
797
|
if type(path) == str:
|
798
798
|
database, table = self.db.database, path
|
799
799
|
else:
|
@@ -887,7 +887,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
887
887
|
SQL.
|
888
888
|
"""
|
889
889
|
|
890
|
-
#
|
890
|
+
# Parameter.
|
891
891
|
if type(path) == str:
|
892
892
|
database, table = self.db.database, path
|
893
893
|
else:
|
@@ -918,7 +918,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
918
918
|
SQL.
|
919
919
|
"""
|
920
920
|
|
921
|
-
#
|
921
|
+
# Parameter.
|
922
922
|
if type(path) == str:
|
923
923
|
database, table = self.db.database, path
|
924
924
|
else:
|
@@ -1105,7 +1105,7 @@ class DatabaseBuild(DatabaseBuildSuper['rdb.Database']):
|
|
1105
1105
|
skip : Whether skip existing table.
|
1106
1106
|
"""
|
1107
1107
|
|
1108
|
-
#
|
1108
|
+
# Parameter.
|
1109
1109
|
databases = databases or []
|
1110
1110
|
tables = tables or []
|
1111
1111
|
views = views or []
|
@@ -1325,7 +1325,7 @@ class DatabaseBuildAsync(DatabaseBuildSuper['rdb.DatabaseAsync']):
|
|
1325
1325
|
skip : Whether skip existing table.
|
1326
1326
|
"""
|
1327
1327
|
|
1328
|
-
#
|
1328
|
+
# Parameter.
|
1329
1329
|
databases = databases or []
|
1330
1330
|
tables = tables or []
|
1331
1331
|
tables_orm = tables_orm or []
|
@@ -1602,7 +1602,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1602
1602
|
Field set SQL.
|
1603
1603
|
"""
|
1604
1604
|
|
1605
|
-
#
|
1605
|
+
# Parameter.
|
1606
1606
|
|
1607
1607
|
## Constraint.
|
1608
1608
|
constraint = ' ' + constraint
|
@@ -1656,7 +1656,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1656
1656
|
Index set SQL.
|
1657
1657
|
"""
|
1658
1658
|
|
1659
|
-
#
|
1659
|
+
# Parameter.
|
1660
1660
|
if fields.__class__ == str:
|
1661
1661
|
fields = [fields]
|
1662
1662
|
match type_:
|
@@ -1756,7 +1756,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1756
1756
|
SQL.
|
1757
1757
|
"""
|
1758
1758
|
|
1759
|
-
#
|
1759
|
+
# Parameter.
|
1760
1760
|
if type(path) == str:
|
1761
1761
|
database, table = self.db.database, path
|
1762
1762
|
else:
|
@@ -1844,7 +1844,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1844
1844
|
SQL.
|
1845
1845
|
"""
|
1846
1846
|
|
1847
|
-
#
|
1847
|
+
# Parameter.
|
1848
1848
|
if type(path) == str:
|
1849
1849
|
database, table = self.db.database, path
|
1850
1850
|
else:
|
@@ -1959,7 +1959,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1959
1959
|
SQL.
|
1960
1960
|
"""
|
1961
1961
|
|
1962
|
-
#
|
1962
|
+
# Parameter.
|
1963
1963
|
if type(path) == str:
|
1964
1964
|
database, table = self.db.database, path
|
1965
1965
|
else:
|
@@ -1990,7 +1990,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
1990
1990
|
SQL.
|
1991
1991
|
"""
|
1992
1992
|
|
1993
|
-
#
|
1993
|
+
# Parameter.
|
1994
1994
|
if type(path) == str:
|
1995
1995
|
database, table = self.db.database, path
|
1996
1996
|
else:
|
@@ -2097,7 +2097,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
2097
2097
|
SQL.
|
2098
2098
|
"""
|
2099
2099
|
|
2100
|
-
#
|
2100
|
+
# Parameter.
|
2101
2101
|
if type(path) == str:
|
2102
2102
|
database, table = self.db.database, path
|
2103
2103
|
else:
|
@@ -2185,7 +2185,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
2185
2185
|
SQL.
|
2186
2186
|
"""
|
2187
2187
|
|
2188
|
-
#
|
2188
|
+
# Parameter.
|
2189
2189
|
if type(path) == str:
|
2190
2190
|
database, table = self.db.database, path
|
2191
2191
|
else:
|
@@ -2273,7 +2273,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
2273
2273
|
SQL.
|
2274
2274
|
"""
|
2275
2275
|
|
2276
|
-
#
|
2276
|
+
# Parameter.
|
2277
2277
|
if type(path) == str:
|
2278
2278
|
database, table = self.db.database, path
|
2279
2279
|
else:
|
@@ -2367,7 +2367,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
2367
2367
|
SQL.
|
2368
2368
|
"""
|
2369
2369
|
|
2370
|
-
#
|
2370
|
+
# Parameter.
|
2371
2371
|
if type(path) == str:
|
2372
2372
|
database, table = self.db.database, path
|
2373
2373
|
else:
|
@@ -2398,7 +2398,7 @@ class DatabaseBuildSuper(DatabaseBase, Generic[DatabaseT]):
|
|
2398
2398
|
SQL.
|
2399
2399
|
"""
|
2400
2400
|
|
2401
|
-
#
|
2401
|
+
# Parameter.
|
2402
2402
|
if type(path) == str:
|
2403
2403
|
database, table = self.db.database, path
|
2404
2404
|
else:
|
@@ -2599,7 +2599,7 @@ class DatabaseBuild(DatabaseBuildSuper['rdb.Database']):
|
|
2599
2599
|
skip : Whether skip existing table.
|
2600
2600
|
"""
|
2601
2601
|
|
2602
|
-
#
|
2602
|
+
# Parameter.
|
2603
2603
|
databases = databases or []
|
2604
2604
|
tables = tables or []
|
2605
2605
|
views = views or []
|
@@ -2815,7 +2815,7 @@ class DatabaseBuildAsync(DatabaseBuildSuper['rdb.DatabaseAsync']):
|
|
2815
2815
|
skip : Whether skip existing table.
|
2816
2816
|
"""
|
2817
2817
|
|
2818
|
-
#
|
2818
|
+
# Parameter.
|
2819
2819
|
databases = databases or []
|
2820
2820
|
tables = tables or []
|
2821
2821
|
tables_orm = tables_orm or []
|
reydb/rconfig.py
CHANGED
@@ -57,17 +57,8 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
57
57
|
"""
|
58
58
|
Database config super type.
|
59
59
|
Can create database used `self.build_db` method.
|
60
|
-
|
61
|
-
Attributes
|
62
|
-
----------
|
63
|
-
db_names : Database table name mapping dictionary.
|
64
60
|
"""
|
65
61
|
|
66
|
-
db_names = {
|
67
|
-
'config': 'config',
|
68
|
-
'stats_config': 'stats_config'
|
69
|
-
}
|
70
|
-
|
71
62
|
|
72
63
|
def __init__(self, db: DatabaseT) -> None:
|
73
64
|
"""
|
@@ -84,29 +75,29 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
84
75
|
|
85
76
|
def handle_build_db(self) -> tuple[list[type[DatabaseTableConfig]], list[dict[str, Any]]] :
|
86
77
|
"""
|
87
|
-
Handle method of check and build database tables
|
78
|
+
Handle method of check and build database tables.
|
88
79
|
|
89
80
|
Returns
|
90
81
|
-------
|
91
82
|
Build database parameter.
|
92
83
|
"""
|
93
84
|
|
94
|
-
#
|
85
|
+
# Parameter.
|
86
|
+
database = self.db.database
|
95
87
|
|
96
88
|
## Table.
|
97
|
-
DatabaseTableConfig._set_name(self.db_names['config'])
|
98
89
|
tables = [DatabaseTableConfig]
|
99
90
|
|
100
91
|
## View stats.
|
101
92
|
views_stats = [
|
102
93
|
{
|
103
|
-
'path':
|
94
|
+
'path': 'stats_config',
|
104
95
|
'items': [
|
105
96
|
{
|
106
97
|
'name': 'count',
|
107
98
|
'select': (
|
108
99
|
'SELECT COUNT(1)\n'
|
109
|
-
f'FROM `{
|
100
|
+
f'FROM `{database}`.`config`'
|
110
101
|
),
|
111
102
|
'comment': 'Config count.'
|
112
103
|
},
|
@@ -114,7 +105,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
114
105
|
'name': 'last_create_time',
|
115
106
|
'select': (
|
116
107
|
'SELECT MAX(`create_time`)\n'
|
117
|
-
f'FROM `{
|
108
|
+
f'FROM `{database}`.`config`'
|
118
109
|
),
|
119
110
|
'comment': 'Config last record create time.'
|
120
111
|
},
|
@@ -122,7 +113,7 @@ class DatabaseConfigSuper(DatabaseBase, Generic[DatabaseT]):
|
|
122
113
|
'name': 'last_update_time',
|
123
114
|
'select': (
|
124
115
|
'SELECT MAX(`update_time`)\n'
|
125
|
-
f'FROM `{
|
116
|
+
f'FROM `{database}`.`config`'
|
126
117
|
),
|
127
118
|
'comment': 'Config last record update time.'
|
128
119
|
}
|
@@ -150,10 +141,10 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
150
141
|
|
151
142
|
def build_db(self) -> None:
|
152
143
|
"""
|
153
|
-
Check and build database tables
|
144
|
+
Check and build database tables.
|
154
145
|
"""
|
155
146
|
|
156
|
-
#
|
147
|
+
# Parameter.
|
157
148
|
tables, views_stats = self.handle_build_db()
|
158
149
|
|
159
150
|
# Build.
|
@@ -171,7 +162,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
171
162
|
|
172
163
|
# Get.
|
173
164
|
result = self.db.execute.select(
|
174
|
-
|
165
|
+
'config',
|
175
166
|
['key', 'value', 'note'],
|
176
167
|
order='IFNULL(`update_time`, `create_time`) DESC'
|
177
168
|
)
|
@@ -207,7 +198,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
207
198
|
# Get.
|
208
199
|
where = '`key` = :key'
|
209
200
|
result = self.db.execute.select(
|
210
|
-
|
201
|
+
'config',
|
211
202
|
'`value`',
|
212
203
|
where,
|
213
204
|
limit=1,
|
@@ -253,7 +244,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
253
244
|
'note': note
|
254
245
|
}
|
255
246
|
result = self.db.execute.insert(
|
256
|
-
|
247
|
+
'config',
|
257
248
|
data,
|
258
249
|
'ignore'
|
259
250
|
)
|
@@ -276,7 +267,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
276
267
|
- `ConfigTable`: Multiple configs.
|
277
268
|
"""
|
278
269
|
|
279
|
-
#
|
270
|
+
# Parameter.
|
280
271
|
if type(data) == dict:
|
281
272
|
data = [data]
|
282
273
|
data = data.copy()
|
@@ -286,7 +277,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
286
277
|
|
287
278
|
# Update.
|
288
279
|
self.db.execute.insert(
|
289
|
-
|
280
|
+
'config',
|
290
281
|
data,
|
291
282
|
'update'
|
292
283
|
)
|
@@ -309,7 +300,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
309
300
|
where = '`key` in :key'
|
310
301
|
limit = None
|
311
302
|
result = self.db.execute.delete(
|
312
|
-
|
303
|
+
'config',
|
313
304
|
where,
|
314
305
|
limit=limit,
|
315
306
|
key=key
|
@@ -331,7 +322,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
331
322
|
|
332
323
|
# Get.
|
333
324
|
result = self.db.execute.select(
|
334
|
-
|
325
|
+
'config',
|
335
326
|
['key', 'value']
|
336
327
|
)
|
337
328
|
|
@@ -357,7 +348,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
357
348
|
|
358
349
|
# Get.
|
359
350
|
result = self.db.execute.select(
|
360
|
-
|
351
|
+
'config',
|
361
352
|
'`key`'
|
362
353
|
)
|
363
354
|
|
@@ -382,7 +373,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
382
373
|
|
383
374
|
# Get.
|
384
375
|
result = self.db.execute.select(
|
385
|
-
|
376
|
+
'config',
|
386
377
|
'`value`'
|
387
378
|
)
|
388
379
|
|
@@ -433,7 +424,7 @@ class DatabaseConfig(DatabaseConfigSuper['rdb.Database']):
|
|
433
424
|
value : Config value.
|
434
425
|
"""
|
435
426
|
|
436
|
-
#
|
427
|
+
# Parameter.
|
437
428
|
if type(key_and_note) != str:
|
438
429
|
key, note = key_and_note
|
439
430
|
else:
|
@@ -466,10 +457,10 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
466
457
|
|
467
458
|
async def build_db(self) -> None:
|
468
459
|
"""
|
469
|
-
Asynchronous check and build database tables
|
460
|
+
Asynchronous check and build database tables.
|
470
461
|
"""
|
471
462
|
|
472
|
-
#
|
463
|
+
# Parameter.
|
473
464
|
tables, views_stats = self.handle_build_db()
|
474
465
|
|
475
466
|
# Build.
|
@@ -487,7 +478,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
487
478
|
|
488
479
|
# Get.
|
489
480
|
result = await self.db.execute.select(
|
490
|
-
|
481
|
+
'config',
|
491
482
|
['key', 'value', 'note'],
|
492
483
|
order='IFNULL(`update_time`, `create_time`) DESC'
|
493
484
|
)
|
@@ -523,7 +514,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
523
514
|
# Get.
|
524
515
|
where = '`key` = :key'
|
525
516
|
result = await self.db.execute.select(
|
526
|
-
|
517
|
+
'config',
|
527
518
|
'`value`',
|
528
519
|
where,
|
529
520
|
limit=1,
|
@@ -569,7 +560,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
569
560
|
'note': note
|
570
561
|
}
|
571
562
|
result = await self.db.execute.insert(
|
572
|
-
|
563
|
+
'config',
|
573
564
|
data,
|
574
565
|
'ignore'
|
575
566
|
)
|
@@ -592,7 +583,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
592
583
|
- `ConfigTable`: Multiple configs.
|
593
584
|
"""
|
594
585
|
|
595
|
-
#
|
586
|
+
# Parameter.
|
596
587
|
if type(data) == dict:
|
597
588
|
data = [data]
|
598
589
|
data = data.copy()
|
@@ -602,7 +593,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
602
593
|
|
603
594
|
# Update.
|
604
595
|
await self.db.execute.insert(
|
605
|
-
|
596
|
+
'config',
|
606
597
|
data,
|
607
598
|
'update'
|
608
599
|
)
|
@@ -625,7 +616,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
625
616
|
where = '`key` in :key'
|
626
617
|
limit = None
|
627
618
|
result = await self.db.execute.delete(
|
628
|
-
|
619
|
+
'config',
|
629
620
|
where,
|
630
621
|
limit=limit,
|
631
622
|
key=key
|
@@ -647,7 +638,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
647
638
|
|
648
639
|
# Get.
|
649
640
|
result = await self.db.execute.select(
|
650
|
-
|
641
|
+
'config',
|
651
642
|
['key', 'value']
|
652
643
|
)
|
653
644
|
|
@@ -673,7 +664,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
673
664
|
|
674
665
|
# Get.
|
675
666
|
result = await self.db.execute.select(
|
676
|
-
|
667
|
+
'config',
|
677
668
|
'`key`'
|
678
669
|
)
|
679
670
|
|
@@ -698,7 +689,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
698
689
|
|
699
690
|
# Get.
|
700
691
|
result = await self.db.execute.select(
|
701
|
-
|
692
|
+
'config',
|
702
693
|
'`value`'
|
703
694
|
)
|
704
695
|
|
@@ -749,7 +740,7 @@ class DatabaseConfigAsync(DatabaseConfigSuper['rdb.DatabaseAsync']):
|
|
749
740
|
value : Config value.
|
750
741
|
"""
|
751
742
|
|
752
|
-
#
|
743
|
+
# Parameter.
|
753
744
|
if type(key_and_note) != str:
|
754
745
|
key, note = key_and_note
|
755
746
|
else:
|
reydb/rdb.py
CHANGED
@@ -113,7 +113,7 @@ class DatabaseSuper(
|
|
113
113
|
query : Remote server database parameters.
|
114
114
|
"""
|
115
115
|
|
116
|
-
#
|
116
|
+
# Parameter.
|
117
117
|
if type(port) == str:
|
118
118
|
port = int(port)
|
119
119
|
|
@@ -237,7 +237,7 @@ class DatabaseSuper(
|
|
237
237
|
Engine object.
|
238
238
|
"""
|
239
239
|
|
240
|
-
#
|
240
|
+
# Parameter.
|
241
241
|
engine_params = {
|
242
242
|
'url': self.url,
|
243
243
|
'pool_size': self.pool_size,
|
reydb/rerror.py
CHANGED
@@ -51,17 +51,8 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
51
51
|
"""
|
52
52
|
Database error super type.
|
53
53
|
Can create database used `self.build_db` method.
|
54
|
-
|
55
|
-
Attributes
|
56
|
-
----------
|
57
|
-
db_names : Database table name mapping dictionary.
|
58
54
|
"""
|
59
55
|
|
60
|
-
db_names = {
|
61
|
-
'error': 'error',
|
62
|
-
'stats_error': 'stats_error'
|
63
|
-
}
|
64
|
-
|
65
56
|
|
66
57
|
def __init__(self, db: DatabaseT) -> None:
|
67
58
|
"""
|
@@ -78,29 +69,29 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
78
69
|
|
79
70
|
def handle_build_db(self) -> tuple[list[type[DatabaseTableError]], list[dict[str, Any]]]:
|
80
71
|
"""
|
81
|
-
Handle method of check and build database tables
|
72
|
+
Handle method of check and build database tables.
|
82
73
|
|
83
74
|
Returns
|
84
75
|
-------
|
85
76
|
Build database parameter.
|
86
77
|
"""
|
87
78
|
|
88
|
-
#
|
79
|
+
# Parameter.
|
80
|
+
database = self.db.database
|
89
81
|
|
90
82
|
## Table.
|
91
|
-
DatabaseTableError._set_name(self.db_names['error'])
|
92
83
|
tables = [DatabaseTableError]
|
93
84
|
|
94
85
|
## View stats.
|
95
86
|
views_stats = [
|
96
87
|
{
|
97
|
-
'path':
|
88
|
+
'path': 'stats_error',
|
98
89
|
'items': [
|
99
90
|
{
|
100
91
|
'name': 'count',
|
101
92
|
'select': (
|
102
93
|
'SELECT COUNT(1)\n'
|
103
|
-
f'FROM `{
|
94
|
+
f'FROM `{database}`.`error`'
|
104
95
|
),
|
105
96
|
'comment': 'Error log count.'
|
106
97
|
},
|
@@ -108,7 +99,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
108
99
|
'name': 'past_day_count',
|
109
100
|
'select': (
|
110
101
|
'SELECT COUNT(1)\n'
|
111
|
-
f'FROM `{
|
102
|
+
f'FROM `{database}`.`error`\n'
|
112
103
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) = 0'
|
113
104
|
),
|
114
105
|
'comment': 'Error log count in the past day.'
|
@@ -117,7 +108,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
117
108
|
'name': 'past_week_count',
|
118
109
|
'select': (
|
119
110
|
'SELECT COUNT(1)\n'
|
120
|
-
f'FROM `{
|
111
|
+
f'FROM `{database}`.`error`\n'
|
121
112
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 6'
|
122
113
|
),
|
123
114
|
'comment': 'Error log count in the past week.'
|
@@ -126,7 +117,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
126
117
|
'name': 'past_month_count',
|
127
118
|
'select': (
|
128
119
|
'SELECT COUNT(1)\n'
|
129
|
-
f'FROM `{
|
120
|
+
f'FROM `{database}`.`error`\n'
|
130
121
|
'WHERE TIMESTAMPDIFF(DAY, `create_time`, NOW()) <= 29'
|
131
122
|
),
|
132
123
|
'comment': 'Error log count in the past month.'
|
@@ -135,7 +126,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
135
126
|
'name': 'last_time',
|
136
127
|
'select': (
|
137
128
|
'SELECT MAX(`create_time`)\n'
|
138
|
-
f'FROM `{
|
129
|
+
f'FROM `{database}`.`error`'
|
139
130
|
),
|
140
131
|
'comment': 'Error log last record create time.'
|
141
132
|
}
|
@@ -162,7 +153,7 @@ class DatabaseErrorSuper(DatabaseBase, Generic[DatabaseT]):
|
|
162
153
|
note : Exception note.
|
163
154
|
"""
|
164
155
|
|
165
|
-
#
|
156
|
+
# Parameter.
|
166
157
|
exc_type = type(exc).__name__
|
167
158
|
exc_data = list(exc.args) or None
|
168
159
|
exc_stack = [
|
@@ -193,10 +184,10 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
193
184
|
|
194
185
|
def build_db(self) -> None:
|
195
186
|
"""
|
196
|
-
Check and build database tables
|
187
|
+
Check and build database tables.
|
197
188
|
"""
|
198
189
|
|
199
|
-
#
|
190
|
+
# Parameter.
|
200
191
|
tables, views_stats = self.handle_build_db()
|
201
192
|
|
202
193
|
# Build.
|
@@ -219,12 +210,12 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
219
210
|
note : Exception note.
|
220
211
|
"""
|
221
212
|
|
222
|
-
#
|
213
|
+
# Parameter.
|
223
214
|
data = self.handle_record(exc, stack, note)
|
224
215
|
|
225
216
|
# Insert.
|
226
217
|
self.db.execute.insert(
|
227
|
-
|
218
|
+
'error',
|
228
219
|
data=data
|
229
220
|
)
|
230
221
|
|
@@ -246,7 +237,7 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
246
237
|
filter_type : Exception types of not insert, but still throw exception.
|
247
238
|
"""
|
248
239
|
|
249
|
-
#
|
240
|
+
# Parameter.
|
250
241
|
_, exc, stack = catch_exc()
|
251
242
|
|
252
243
|
# Filter.
|
@@ -304,7 +295,7 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
304
295
|
>>> func(*args, **kwargs)
|
305
296
|
"""
|
306
297
|
|
307
|
-
#
|
298
|
+
# Parameter.
|
308
299
|
if issubclass(filter_type, BaseException):
|
309
300
|
filter_type = (filter_type,)
|
310
301
|
|
@@ -364,17 +355,17 @@ class DatabaseError(DatabaseErrorSuper['rdb.Database']):
|
|
364
355
|
|
365
356
|
class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
366
357
|
"""
|
367
|
-
|
358
|
+
Asynchronous database error type.
|
368
359
|
Can create database used `self.build_db` method.
|
369
360
|
"""
|
370
361
|
|
371
362
|
|
372
363
|
async def build_db(self) -> None:
|
373
364
|
"""
|
374
|
-
|
365
|
+
Asynchronous check and build database tables.
|
375
366
|
"""
|
376
367
|
|
377
|
-
#
|
368
|
+
# Parameter.
|
378
369
|
tables, views_stats = self.handle_build_db()
|
379
370
|
|
380
371
|
# Build.
|
@@ -388,7 +379,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
388
379
|
note: str | None = None
|
389
380
|
) -> None:
|
390
381
|
"""
|
391
|
-
|
382
|
+
Asynchronous insert exception information into the table of database.
|
392
383
|
|
393
384
|
Parameters
|
394
385
|
----------
|
@@ -397,12 +388,12 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
397
388
|
note : Exception note.
|
398
389
|
"""
|
399
390
|
|
400
|
-
#
|
391
|
+
# Parameter.
|
401
392
|
data = self.handle_record(exc, stack, note)
|
402
393
|
|
403
394
|
# Insert.
|
404
395
|
await self.db.execute.insert(
|
405
|
-
|
396
|
+
'error',
|
406
397
|
data=data
|
407
398
|
)
|
408
399
|
|
@@ -416,7 +407,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
416
407
|
filter_type : BaseException | tuple[BaseException, ...] = Exit
|
417
408
|
) -> NoReturn:
|
418
409
|
"""
|
419
|
-
|
410
|
+
Asynchronous catch and insert exception information into the table of database and throw exception, must used in except syntax.
|
420
411
|
|
421
412
|
Parameters
|
422
413
|
----------
|
@@ -424,7 +415,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
424
415
|
filter_type : Exception types of not insert, but still throw exception.
|
425
416
|
"""
|
426
417
|
|
427
|
-
#
|
418
|
+
# Parameter.
|
428
419
|
_, exc, stack = catch_exc()
|
429
420
|
|
430
421
|
# Filter.
|
@@ -448,7 +439,7 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
448
439
|
filter_type : BaseException | tuple[BaseException, ...] = Exit
|
449
440
|
) -> T | Callable[[Callable[..., T]], Callable[..., T]]:
|
450
441
|
"""
|
451
|
-
|
442
|
+
Asynchronous decorator, insert exception information into the table of database, throw exception.
|
452
443
|
|
453
444
|
Parameters
|
454
445
|
----------
|
@@ -479,11 +470,11 @@ class DatabaseErrorAsync(DatabaseErrorSuper['rdb.DatabaseAsync']):
|
|
479
470
|
>>> wrap = wrap(**wrap_kwargs)
|
480
471
|
>>> func = wrap(func)
|
481
472
|
|
482
|
-
Must
|
473
|
+
Must asynchronous execute.
|
483
474
|
>>> await func(*args, **kwargs)
|
484
475
|
"""
|
485
476
|
|
486
|
-
#
|
477
|
+
# Parameter.
|
487
478
|
if issubclass(filter_type, BaseException):
|
488
479
|
filter_type = (filter_type,)
|
489
480
|
|
reydb/rexec.py
CHANGED
@@ -87,7 +87,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
87
87
|
Parameter `sql` and `data` and `report`.
|
88
88
|
"""
|
89
89
|
|
90
|
-
#
|
90
|
+
# Parameter.
|
91
91
|
echo = get_first_notnone(echo, self.conn.db.echo)
|
92
92
|
sql = handle_sql(sql)
|
93
93
|
if data is None:
|
@@ -142,7 +142,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
142
142
|
Parameter `sql`.
|
143
143
|
"""
|
144
144
|
|
145
|
-
#
|
145
|
+
# Parameter.
|
146
146
|
if type(path) == str:
|
147
147
|
database, table = self.conn.db.database, path
|
148
148
|
else:
|
@@ -240,7 +240,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
240
240
|
Parameter `sql` and `kwdata`.
|
241
241
|
"""
|
242
242
|
|
243
|
-
#
|
243
|
+
# Parameter.
|
244
244
|
if type(path) == str:
|
245
245
|
database, table = self.conn.db.database, path
|
246
246
|
else:
|
@@ -383,7 +383,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
383
383
|
Parameter `sql` and `data`.
|
384
384
|
"""
|
385
385
|
|
386
|
-
#
|
386
|
+
# Parameter.
|
387
387
|
if type(path) == str:
|
388
388
|
database, table = self.conn.db.database, path
|
389
389
|
else:
|
@@ -517,7 +517,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
517
517
|
Parameter `sql`.
|
518
518
|
"""
|
519
519
|
|
520
|
-
#
|
520
|
+
# Parameter.
|
521
521
|
if type(path) == str:
|
522
522
|
database, table = self.conn.db.database, path
|
523
523
|
else:
|
@@ -580,7 +580,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
580
580
|
Parameter `sql`.
|
581
581
|
"""
|
582
582
|
|
583
|
-
#
|
583
|
+
# Parameter.
|
584
584
|
if type(path) == str:
|
585
585
|
database, table = self.conn.db.database, path
|
586
586
|
else:
|
@@ -658,7 +658,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
658
658
|
Result object.
|
659
659
|
"""
|
660
660
|
|
661
|
-
#
|
661
|
+
# Parameter.
|
662
662
|
sql, data, echo = self.handle_execute(sql, data, echo, **kwdata)
|
663
663
|
|
664
664
|
# Transaction.
|
@@ -755,7 +755,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
755
755
|
[{'id': 1, 'id_': 2}, ...]
|
756
756
|
"""
|
757
757
|
|
758
|
-
#
|
758
|
+
# Parameter.
|
759
759
|
sql = self.handle_select(path, fields, where, group, having, order, limit)
|
760
760
|
|
761
761
|
# Execute SQL.
|
@@ -808,7 +808,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
808
808
|
[{'key': 'a', 'value1': 1, 'value2': 2}, {'key': 'b', 'value1': 1, 'value2': 2}]
|
809
809
|
"""
|
810
810
|
|
811
|
-
#
|
811
|
+
# Parameter.
|
812
812
|
sql, kwdata = self.handle_insert(path, data, duplicate, **kwdata)
|
813
813
|
|
814
814
|
# Execute SQL.
|
@@ -867,7 +867,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
867
867
|
[{'key': 'a', 'value': 1, 'name': 'a'}, {'key': 'b', 'value': 1, 'name': 'b'}]
|
868
868
|
"""
|
869
869
|
|
870
|
-
#
|
870
|
+
# Parameter.
|
871
871
|
sql, data = self.handle_update(path, data, where_fields, **kwdata)
|
872
872
|
|
873
873
|
# Execute SQL.
|
@@ -913,7 +913,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
913
913
|
2
|
914
914
|
"""
|
915
915
|
|
916
|
-
#
|
916
|
+
# Parameter.
|
917
917
|
sql = self.handle_delete(path, where, order, limit)
|
918
918
|
|
919
919
|
# Execute SQL.
|
@@ -964,7 +964,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
964
964
|
2
|
965
965
|
"""
|
966
966
|
|
967
|
-
#
|
967
|
+
# Parameter.
|
968
968
|
sql = self.handle_copy(path, fields, where, limit)
|
969
969
|
|
970
970
|
# Execute SQL.
|
@@ -1145,7 +1145,7 @@ class DatabaseExecute(DatabaseExecuteSuper['rconn.DatabaseConnection']):
|
|
1145
1145
|
- When parameters `precision` is `greater than 0`, then return float.
|
1146
1146
|
"""
|
1147
1147
|
|
1148
|
-
#
|
1148
|
+
# Parameter.
|
1149
1149
|
if len(thresholds) == 1:
|
1150
1150
|
second = thresholds[0]
|
1151
1151
|
else:
|
@@ -1187,7 +1187,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1187
1187
|
Result object.
|
1188
1188
|
"""
|
1189
1189
|
|
1190
|
-
#
|
1190
|
+
# Parameter.
|
1191
1191
|
sql, data, echo = self.handle_execute(sql, data, echo, **kwdata)
|
1192
1192
|
|
1193
1193
|
# Transaction.
|
@@ -1301,7 +1301,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1301
1301
|
[{'id': 1, 'id_': 2}, ...]
|
1302
1302
|
"""
|
1303
1303
|
|
1304
|
-
#
|
1304
|
+
# Parameter.
|
1305
1305
|
sql = self.handle_select(path, fields, where, group, having, order, limit)
|
1306
1306
|
|
1307
1307
|
# Execute SQL.
|
@@ -1354,7 +1354,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1354
1354
|
[{'key': 'a', 'value1': 1, 'value2': 2}, {'key': 'b', 'value1': 1, 'value2': 2}]
|
1355
1355
|
"""
|
1356
1356
|
|
1357
|
-
#
|
1357
|
+
# Parameter.
|
1358
1358
|
sql, kwdata = self.handle_insert(path, data, duplicate, **kwdata)
|
1359
1359
|
|
1360
1360
|
# Execute SQL.
|
@@ -1413,7 +1413,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1413
1413
|
[{'key': 'a', 'value': 1, 'name': 'a'}, {'key': 'b', 'value': 1, 'name': 'b'}]
|
1414
1414
|
"""
|
1415
1415
|
|
1416
|
-
#
|
1416
|
+
# Parameter.
|
1417
1417
|
sql, data = self.handle_update(path, data, where_fields, **kwdata)
|
1418
1418
|
|
1419
1419
|
# Execute SQL.
|
@@ -1459,7 +1459,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1459
1459
|
2
|
1460
1460
|
"""
|
1461
1461
|
|
1462
|
-
#
|
1462
|
+
# Parameter.
|
1463
1463
|
sql = self.handle_delete(path, where, order, limit)
|
1464
1464
|
|
1465
1465
|
# Execute SQL.
|
@@ -1510,7 +1510,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1510
1510
|
2
|
1511
1511
|
"""
|
1512
1512
|
|
1513
|
-
#
|
1513
|
+
# Parameter.
|
1514
1514
|
sql = self.handle_copy(path, fields, where, limit)
|
1515
1515
|
|
1516
1516
|
# Execute SQL.
|
@@ -1689,7 +1689,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1689
1689
|
- When parameters `precision` is `greater than 0`, then return float.
|
1690
1690
|
"""
|
1691
1691
|
|
1692
|
-
#
|
1692
|
+
# Parameter.
|
1693
1693
|
if len(thresholds) == 1:
|
1694
1694
|
second = thresholds[0]
|
1695
1695
|
else:
|
reydb/rinfo.py
CHANGED
@@ -59,7 +59,7 @@ class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseT]
|
|
59
59
|
db: Database instance.
|
60
60
|
"""
|
61
61
|
|
62
|
-
#
|
62
|
+
# Parameter.
|
63
63
|
self.db = db
|
64
64
|
|
65
65
|
def handle_before__call__(self, filter_default: bool = True) -> tuple[str, tuple[str, ...]]:
|
@@ -75,7 +75,7 @@ class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseT]
|
|
75
75
|
Parameter `sql` and `filter_db`.
|
76
76
|
"""
|
77
77
|
|
78
|
-
#
|
78
|
+
# Parameter.
|
79
79
|
filter_db = (
|
80
80
|
'information_schema',
|
81
81
|
'performance_schema',
|
@@ -193,7 +193,7 @@ class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseT]
|
|
193
193
|
Judge result.
|
194
194
|
"""
|
195
195
|
|
196
|
-
#
|
196
|
+
# Parameter.
|
197
197
|
|
198
198
|
# Judge.
|
199
199
|
judge = (
|
@@ -298,7 +298,7 @@ class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rdb.Database']):
|
|
298
298
|
Judge result.
|
299
299
|
"""
|
300
300
|
|
301
|
-
#
|
301
|
+
# Parameter.
|
302
302
|
if (
|
303
303
|
cache
|
304
304
|
and self.db._schema is not None
|
@@ -395,7 +395,7 @@ class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rdb.Databas
|
|
395
395
|
Judge result.
|
396
396
|
"""
|
397
397
|
|
398
|
-
#
|
398
|
+
# Parameter.
|
399
399
|
if (
|
400
400
|
refresh
|
401
401
|
or self.db._schema is None
|
@@ -431,7 +431,7 @@ class DatabaseInformationParameterSuper(DatabaseInformationBase, Generic[Databas
|
|
431
431
|
db: Database instance.
|
432
432
|
"""
|
433
433
|
|
434
|
-
#
|
434
|
+
# Parameter.
|
435
435
|
self.db = db
|
436
436
|
|
437
437
|
|
@@ -559,13 +559,13 @@ class DatabaseInformationParameter(DatabaseInformationParameterSuper['rdb.Databa
|
|
559
559
|
|
560
560
|
class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.DatabaseAsync']):
|
561
561
|
"""
|
562
|
-
|
562
|
+
Asynchronous database information parameters type.
|
563
563
|
"""
|
564
564
|
|
565
565
|
|
566
566
|
async def __getitem__(self, key: str) -> str | None:
|
567
567
|
"""
|
568
|
-
|
568
|
+
Asynchronous get item of parameter dictionary.
|
569
569
|
|
570
570
|
Parameters
|
571
571
|
----------
|
@@ -584,7 +584,7 @@ class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.D
|
|
584
584
|
|
585
585
|
async def __setitem__(self, key: str, value: str | float) -> None:
|
586
586
|
"""
|
587
|
-
|
587
|
+
Asynchronous set item of parameter dictionary.
|
588
588
|
|
589
589
|
Parameters
|
590
590
|
----------
|
@@ -607,7 +607,7 @@ class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.D
|
|
607
607
|
|
608
608
|
async def get(self, key: str | None = None) -> dict[str, str] | str | None:
|
609
609
|
"""
|
610
|
-
|
610
|
+
Asynchronous get parameter.
|
611
611
|
|
612
612
|
Parameters
|
613
613
|
----------
|
@@ -649,7 +649,7 @@ class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.D
|
|
649
649
|
|
650
650
|
async def update(self, params: dict[str, str | float]) -> None:
|
651
651
|
"""
|
652
|
-
|
652
|
+
Asynchronous update parameter.
|
653
653
|
|
654
654
|
Parameters
|
655
655
|
----------
|
@@ -721,7 +721,7 @@ class DatabaseInformationParameterStatusGlobal(DatabaseInformationParameter):
|
|
721
721
|
|
722
722
|
class DatabaseInformationParameterVariablesAsync(DatabaseInformationParameterAsync):
|
723
723
|
"""
|
724
|
-
|
724
|
+
Asynchronous database information variable parameters type.
|
725
725
|
"""
|
726
726
|
|
727
727
|
mode: Final = 'VARIABLES'
|
@@ -730,7 +730,7 @@ class DatabaseInformationParameterVariablesAsync(DatabaseInformationParameterAsy
|
|
730
730
|
|
731
731
|
class DatabaseInformationParameterStatusAsync(DatabaseInformationParameterAsync):
|
732
732
|
"""
|
733
|
-
|
733
|
+
Asynchronous database information status parameters type.
|
734
734
|
"""
|
735
735
|
|
736
736
|
mode: Final = 'STATUS'
|
@@ -739,7 +739,7 @@ class DatabaseInformationParameterStatusAsync(DatabaseInformationParameterAsync)
|
|
739
739
|
|
740
740
|
class DatabaseInformationParameterVariablesGlobalAsync(DatabaseInformationParameterAsync):
|
741
741
|
"""
|
742
|
-
|
742
|
+
Asynchronous database information global variable parameters type.
|
743
743
|
"""
|
744
744
|
|
745
745
|
mode: Final = 'VARIABLES'
|
@@ -748,7 +748,7 @@ class DatabaseInformationParameterVariablesGlobalAsync(DatabaseInformationParame
|
|
748
748
|
|
749
749
|
class DatabaseInformationParameterStatusGlobalAsync(DatabaseInformationParameterAsync):
|
750
750
|
"""
|
751
|
-
|
751
|
+
Asynchronous database information global status parameters type.
|
752
752
|
"""
|
753
753
|
|
754
754
|
mode: Final = 'STATUS'
|
reydb/rorm.py
CHANGED
@@ -109,7 +109,7 @@ class DatabaseORMModelMeta(DatabaseORMBase, SQLModelMetaclass):
|
|
109
109
|
kwargs : Type other key arguments.
|
110
110
|
"""
|
111
111
|
|
112
|
-
#
|
112
|
+
# Parameter.
|
113
113
|
if '__annotations__' in attrs:
|
114
114
|
table_args = attrs.setdefault('__table_args__', {})
|
115
115
|
table_args['quote'] = True
|
@@ -164,7 +164,7 @@ class DatabaseORMModelMeta(DatabaseORMBase, SQLModelMetaclass):
|
|
164
164
|
# Super.
|
165
165
|
super().__init__(name, bases, attrs, **kwargs)
|
166
166
|
|
167
|
-
#
|
167
|
+
# Parameter.
|
168
168
|
if (
|
169
169
|
'__annotations__' in attrs
|
170
170
|
and hasattr(cls, '__table__')
|
@@ -261,7 +261,7 @@ class DatabaseORMModelField(DatabaseORMBase, FieldInfo):
|
|
261
261
|
**kwargs : Other key arguments.
|
262
262
|
"""
|
263
263
|
|
264
|
-
#
|
264
|
+
# Parameter.
|
265
265
|
kwargs = {
|
266
266
|
key: value
|
267
267
|
for key, value in kwargs.items()
|
@@ -640,7 +640,7 @@ class DatabaseORMSessionSuper(
|
|
640
640
|
Instance.
|
641
641
|
"""
|
642
642
|
|
643
|
-
#
|
643
|
+
# Parameter.
|
644
644
|
if is_instance(model):
|
645
645
|
model = type(model)
|
646
646
|
|
@@ -667,7 +667,7 @@ class DatabaseORMSessionSuper(
|
|
667
667
|
Instance.
|
668
668
|
"""
|
669
669
|
|
670
|
-
#
|
670
|
+
# Parameter.
|
671
671
|
if is_instance(model):
|
672
672
|
model = type(model)
|
673
673
|
|
@@ -694,7 +694,7 @@ class DatabaseORMSessionSuper(
|
|
694
694
|
Instance.
|
695
695
|
"""
|
696
696
|
|
697
|
-
#
|
697
|
+
# Parameter.
|
698
698
|
if is_instance(model):
|
699
699
|
model = type(model)
|
700
700
|
|
@@ -721,7 +721,7 @@ class DatabaseORMSessionSuper(
|
|
721
721
|
Instance.
|
722
722
|
"""
|
723
723
|
|
724
|
-
#
|
724
|
+
# Parameter.
|
725
725
|
if is_instance(model):
|
726
726
|
model = type(model)
|
727
727
|
|
@@ -908,7 +908,7 @@ class DatabaseORMSession(
|
|
908
908
|
skip : Whether skip existing table.
|
909
909
|
"""
|
910
910
|
|
911
|
-
#
|
911
|
+
# Parameter.
|
912
912
|
tables = [
|
913
913
|
model._get_table()
|
914
914
|
for model in models
|
@@ -937,7 +937,7 @@ class DatabaseORMSession(
|
|
937
937
|
skip : Skip not exist table.
|
938
938
|
"""
|
939
939
|
|
940
|
-
#
|
940
|
+
# Parameter.
|
941
941
|
tables = [
|
942
942
|
model._get_table()
|
943
943
|
for model in models
|
@@ -968,7 +968,7 @@ class DatabaseORMSession(
|
|
968
968
|
With records ORM model instance or null.
|
969
969
|
"""
|
970
970
|
|
971
|
-
#
|
971
|
+
# Parameter.
|
972
972
|
if is_instance(model):
|
973
973
|
model = type(model)
|
974
974
|
|
@@ -1002,7 +1002,7 @@ class DatabaseORMSession(
|
|
1002
1002
|
With records ORM model instance list.
|
1003
1003
|
"""
|
1004
1004
|
|
1005
|
-
#
|
1005
|
+
# Parameter.
|
1006
1006
|
if is_instance(model):
|
1007
1007
|
model = type(model)
|
1008
1008
|
|
@@ -1030,7 +1030,7 @@ class DatabaseORMSession(
|
|
1030
1030
|
With records ORM model instance list.
|
1031
1031
|
"""
|
1032
1032
|
|
1033
|
-
#
|
1033
|
+
# Parameter.
|
1034
1034
|
if is_instance(model):
|
1035
1035
|
model = type(model)
|
1036
1036
|
|
@@ -1280,7 +1280,7 @@ class DatabaseORMSessionAsync(
|
|
1280
1280
|
skip : Whether skip existing table.
|
1281
1281
|
"""
|
1282
1282
|
|
1283
|
-
#
|
1283
|
+
# Parameter.
|
1284
1284
|
tables = [
|
1285
1285
|
model._get_table()
|
1286
1286
|
for model in models
|
@@ -1310,7 +1310,7 @@ class DatabaseORMSessionAsync(
|
|
1310
1310
|
skip : Skip not exist table.
|
1311
1311
|
"""
|
1312
1312
|
|
1313
|
-
#
|
1313
|
+
# Parameter.
|
1314
1314
|
tables = [
|
1315
1315
|
model._get_table()
|
1316
1316
|
for model in models
|
@@ -1342,7 +1342,7 @@ class DatabaseORMSessionAsync(
|
|
1342
1342
|
With records ORM model instance or null.
|
1343
1343
|
"""
|
1344
1344
|
|
1345
|
-
#
|
1345
|
+
# Parameter.
|
1346
1346
|
if is_instance(model):
|
1347
1347
|
model = type(model)
|
1348
1348
|
|
@@ -1376,7 +1376,7 @@ class DatabaseORMSessionAsync(
|
|
1376
1376
|
With records ORM model instance list.
|
1377
1377
|
"""
|
1378
1378
|
|
1379
|
-
#
|
1379
|
+
# Parameter.
|
1380
1380
|
if is_instance(model):
|
1381
1381
|
model = type(model)
|
1382
1382
|
|
@@ -1404,7 +1404,7 @@ class DatabaseORMSessionAsync(
|
|
1404
1404
|
With records ORM model instance list.
|
1405
1405
|
"""
|
1406
1406
|
|
1407
|
-
#
|
1407
|
+
# Parameter.
|
1408
1408
|
if is_instance(model):
|
1409
1409
|
model = type(model)
|
1410
1410
|
|
@@ -1566,7 +1566,7 @@ class DatabaseORMStatementAsync(DatabaseORMStatementSuper[DatabaseORMSessionAsyn
|
|
1566
1566
|
|
1567
1567
|
async def execute(self) -> Result:
|
1568
1568
|
"""
|
1569
|
-
|
1569
|
+
Asynchronous execute statement.
|
1570
1570
|
|
1571
1571
|
Returns
|
1572
1572
|
-------
|
@@ -1655,7 +1655,7 @@ class DatabaseORMStatementSelectSuper(DatabaseORMStatementSuper, Select):
|
|
1655
1655
|
Set self.
|
1656
1656
|
"""
|
1657
1657
|
|
1658
|
-
#
|
1658
|
+
# Parameter.
|
1659
1659
|
clauses = [
|
1660
1660
|
sqlalchemy_text(clause)
|
1661
1661
|
if type(clause) == str
|
@@ -1842,7 +1842,7 @@ class DatabaseORMStatementUpdateSuper(DatabaseORMStatementSuper, Update):
|
|
1842
1842
|
Set self.
|
1843
1843
|
"""
|
1844
1844
|
|
1845
|
-
#
|
1845
|
+
# Parameter.
|
1846
1846
|
clauses = [
|
1847
1847
|
sqlalchemy_text(clause)
|
1848
1848
|
if type(clause) == str
|
@@ -1926,7 +1926,7 @@ class DatabaseORMStatementDeleteSuper(DatabaseORMStatementSuper, Delete):
|
|
1926
1926
|
Set self.
|
1927
1927
|
"""
|
1928
1928
|
|
1929
|
-
#
|
1929
|
+
# Parameter.
|
1930
1930
|
clauses = [
|
1931
1931
|
sqlalchemy_text(clause)
|
1932
1932
|
if type(clause) == str
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: reydb
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.17
|
4
4
|
Summary: Database method set.
|
5
5
|
Project-URL: homepage, https://github.com/reyxbo/reydb/
|
6
6
|
Author-email: Rey <reyxbo@163.com>
|
@@ -12,7 +12,7 @@ License: Copyright 2025 ReyXBo
|
|
12
12
|
|
13
13
|
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
14
|
License-File: LICENSE
|
15
|
-
Keywords: async,
|
15
|
+
Keywords: async,asynchronous,database,db,orm,rey,reyxbo
|
16
16
|
Requires-Python: >=3.12
|
17
17
|
Requires-Dist: aiomysql
|
18
18
|
Requires-Dist: pydantic
|
@@ -24,7 +24,7 @@ Description-Content-Type: text/markdown
|
|
24
24
|
|
25
25
|
# reydb
|
26
26
|
|
27
|
-
>
|
27
|
+
> Backend database method set.
|
28
28
|
|
29
29
|
## Install
|
30
30
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
reydb/__init__.py,sha256=MJkZy2rOM2VSj_L2kaKe6CJfsg334vb3OLVUqavWKfM,558
|
2
|
+
reydb/rall.py,sha256=IxSPGh77xz7ndDC7J8kZ_66Gq_xTAztGtnELUku1Ouw,364
|
3
|
+
reydb/rbase.py,sha256=sl2lZWQVC5kXTJid2v5zmy1lMshYLm2NhEQi_dnY_Bw,8232
|
4
|
+
reydb/rbuild.py,sha256=QZF26KDL6oRb6RyMEtIJcbiX9TJzK2aUPqjqGjflF7s,80834
|
5
|
+
reydb/rconfig.py,sha256=ZmVpoP7GuwuP3536Lz34kaZDG5MCVf0JFBaT5nm1-L8,17686
|
6
|
+
reydb/rconn.py,sha256=guRaR8N6RuzZzujwaeq7HhKWTizF9SrUBqEAFjfjpoo,6909
|
7
|
+
reydb/rdb.py,sha256=s96XLLH8ZmJm-q4J9RRP6KGkxH3MGodPOcWqB-6-V4U,14356
|
8
|
+
reydb/rerror.py,sha256=0AIe7ZpDEe60xTV_FJCCBwzFVHwONh7qxvYpgwzZDvI,14401
|
9
|
+
reydb/rexec.py,sha256=DdmcJ6j4il06wEyvhttac2GpmGdsZJtOEljH7wUvca8,52948
|
10
|
+
reydb/rinfo.py,sha256=1lMnD-eN97vHrQ1DM8X7mQIhyLmCg6V0P2QwSeF07_c,18127
|
11
|
+
reydb/rorm.py,sha256=77QQgQglvA2b4fRH1xBqca7BQ-Hu2MudDopRPJ6E4J4,50761
|
12
|
+
reydb-1.2.17.dist-info/METADATA,sha256=zfoqQQNi3sPymiV82KzaBJS_-c4ZA_3r2VIMq9xK3WU,1647
|
13
|
+
reydb-1.2.17.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
+
reydb-1.2.17.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
+
reydb-1.2.17.dist-info/RECORD,,
|
reydb-1.2.15.dist-info/RECORD
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
reydb/__init__.py,sha256=4mnlkfJfkBfxBpCotVUJ86f4AnT8plqlFbGiH3vZ4PM,550
|
2
|
-
reydb/rall.py,sha256=IxSPGh77xz7ndDC7J8kZ_66Gq_xTAztGtnELUku1Ouw,364
|
3
|
-
reydb/rbase.py,sha256=vx37yV6LlWP89nWAfYyOf0Xm3N_e9eB8z5Mxe-aTEo4,8248
|
4
|
-
reydb/rbuild.py,sha256=0jI0MNl-BIhQtuT_-GeXBPTjG76k9EE3wwEQXGhTJyc,80938
|
5
|
-
reydb/rconfig.py,sha256=C2qBgO-qnSVSYpvOcDisfTqwXLE6VIE014sE7RxtrCg,18328
|
6
|
-
reydb/rconn.py,sha256=guRaR8N6RuzZzujwaeq7HhKWTizF9SrUBqEAFjfjpoo,6909
|
7
|
-
reydb/rdb.py,sha256=syyqZbEu92NbCj9O6_T6iAv7E46CyfQOC4T8qtPfHNs,14364
|
8
|
-
reydb/rerror.py,sha256=uwVuolRp-PmXXUZIA_Qd2S6NSOm1S0vDJvehX6l__U8,14888
|
9
|
-
reydb/rexec.py,sha256=HSu8fCgBjpKY1z6OJI6Ky_0sKMPEv_uCAEAcN7fd2i4,53028
|
10
|
-
reydb/rinfo.py,sha256=LjrqTA7JJbWJsjXwV-zKpbE1htv-whg6239hoQj4yIU,18151
|
11
|
-
reydb/rorm.py,sha256=Iv_GGaQfR34UvwLQin4rDeI-lxOrUxRTcZRDmhizR-8,50841
|
12
|
-
reydb-1.2.15.dist-info/METADATA,sha256=oa2AKyGab8pUTwk3lnkWhlBc38NES1B_hQGENh3o28A,1645
|
13
|
-
reydb-1.2.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
14
|
-
reydb-1.2.15.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
15
|
-
reydb-1.2.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|