reydb 1.2.18__py3-none-any.whl → 1.2.20__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 +3 -1
- reydb/rall.py +2 -1
- reydb/rbase.py +1 -1
- reydb/rbuild.py +51 -1531
- reydb/rconfig.py +29 -29
- reydb/rconn.py +15 -15
- reydb/rdb.py +60 -531
- reydb/rengine.py +596 -0
- reydb/rerror.py +14 -14
- reydb/rexec.py +8 -8
- reydb/rinfo.py +32 -32
- reydb/rorm.py +77 -59
- {reydb-1.2.18.dist-info → reydb-1.2.20.dist-info}/METADATA +1 -1
- reydb-1.2.20.dist-info/RECORD +16 -0
- reydb-1.2.18.dist-info/RECORD +0 -15
- {reydb-1.2.18.dist-info → reydb-1.2.20.dist-info}/WHEEL +0 -0
- {reydb-1.2.18.dist-info → reydb-1.2.20.dist-info}/licenses/LICENSE +0 -0
reydb/rexec.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
"""
|
5
|
-
@Time : 2025-09-22
|
5
|
+
@Time : 2025-09-22
|
6
6
|
@Author : Rey
|
7
7
|
@Contact : reyxbo@163.com
|
8
8
|
@Explain : Execute methods.
|
@@ -87,7 +87,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
87
87
|
"""
|
88
88
|
|
89
89
|
# Parameter.
|
90
|
-
echo = get_first_notnone(echo, self.conn.
|
90
|
+
echo = get_first_notnone(echo, self.conn.engine.echo)
|
91
91
|
sql = handle_sql(sql)
|
92
92
|
if data is None:
|
93
93
|
if kwdata == {}:
|
@@ -143,7 +143,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
143
143
|
|
144
144
|
# Parameter.
|
145
145
|
if type(path) == str:
|
146
|
-
database, table = self.conn.
|
146
|
+
database, table = self.conn.engine.database, path
|
147
147
|
else:
|
148
148
|
database, table = path
|
149
149
|
|
@@ -241,7 +241,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
241
241
|
|
242
242
|
# Parameter.
|
243
243
|
if type(path) == str:
|
244
|
-
database, table = self.conn.
|
244
|
+
database, table = self.conn.engine.database, path
|
245
245
|
else:
|
246
246
|
database, table = path
|
247
247
|
|
@@ -384,7 +384,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
384
384
|
|
385
385
|
# Parameter.
|
386
386
|
if type(path) == str:
|
387
|
-
database, table = self.conn.
|
387
|
+
database, table = self.conn.engine.database, path
|
388
388
|
else:
|
389
389
|
database, table = path
|
390
390
|
|
@@ -518,7 +518,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
518
518
|
|
519
519
|
# Parameter.
|
520
520
|
if type(path) == str:
|
521
|
-
database, table = self.conn.
|
521
|
+
database, table = self.conn.engine.database, path
|
522
522
|
else:
|
523
523
|
database, table = path
|
524
524
|
|
@@ -581,7 +581,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
581
581
|
|
582
582
|
# Parameter.
|
583
583
|
if type(path) == str:
|
584
|
-
database, table = self.conn.
|
584
|
+
database, table = self.conn.engine.database, path
|
585
585
|
else:
|
586
586
|
database, table = path
|
587
587
|
if fields is None:
|
@@ -1236,7 +1236,7 @@ class DatabaseExecuteAsync(DatabaseExecuteSuper['rconn.DatabaseConnectionAsync']
|
|
1236
1236
|
if self.conn.autocommit:
|
1237
1237
|
await self.conn.commit()
|
1238
1238
|
await self.conn.close()
|
1239
|
-
await self.conn.
|
1239
|
+
await self.conn.engine.dispose()
|
1240
1240
|
|
1241
1241
|
return result
|
1242
1242
|
|
reydb/rinfo.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
|
4
4
|
"""
|
5
|
-
@Time : 2022-12-05
|
5
|
+
@Time : 2022-12-05
|
6
6
|
@Author : Rey
|
7
7
|
@Contact : reyxbo@163.com
|
8
8
|
@Explain : Database information methods.
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
from typing import Literal, TypeVar, Generic, Final, overload
|
13
13
|
|
14
|
-
from . import
|
14
|
+
from . import rengine
|
15
15
|
from .rbase import DatabaseBase
|
16
16
|
from .rexec import Result
|
17
17
|
|
@@ -35,7 +35,7 @@ __all__ = (
|
|
35
35
|
)
|
36
36
|
|
37
37
|
|
38
|
-
|
38
|
+
DatabaseEngineT = TypeVar('DatabaseEngineT', 'rengine.DatabaseEngine', 'rengine.DatabaseEngineAsync')
|
39
39
|
|
40
40
|
|
41
41
|
class DatabaseInformationBase(DatabaseBase):
|
@@ -44,23 +44,23 @@ class DatabaseInformationBase(DatabaseBase):
|
|
44
44
|
"""
|
45
45
|
|
46
46
|
|
47
|
-
class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[
|
47
|
+
class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseEngineT]):
|
48
48
|
"""
|
49
49
|
Database information schema super type.
|
50
50
|
"""
|
51
51
|
|
52
52
|
|
53
|
-
def __init__(self,
|
53
|
+
def __init__(self, engine: DatabaseEngineT) -> None:
|
54
54
|
"""
|
55
55
|
Build instance attributes.
|
56
56
|
|
57
57
|
Parameters
|
58
58
|
----------
|
59
|
-
|
59
|
+
engine: Database engine.
|
60
60
|
"""
|
61
61
|
|
62
62
|
# Parameter.
|
63
|
-
self.
|
63
|
+
self.engine = engine
|
64
64
|
|
65
65
|
def handle_before__call__(self, filter_default: bool = True) -> tuple[str, tuple[str, ...]]:
|
66
66
|
"""
|
@@ -214,7 +214,7 @@ class DatabaseInformationSchemaSuper(DatabaseInformationBase, Generic[DatabaseT]
|
|
214
214
|
return judge
|
215
215
|
|
216
216
|
|
217
|
-
class DatabaseInformationSchema(DatabaseInformationSchemaSuper['
|
217
|
+
class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rengine.DatabaseEngine']):
|
218
218
|
"""
|
219
219
|
Database information schema type.
|
220
220
|
"""
|
@@ -235,14 +235,14 @@ class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rdb.Database']):
|
|
235
235
|
|
236
236
|
# Get.
|
237
237
|
sql, filter_db = self.handle_before__call__(filter_default)
|
238
|
-
result = self.
|
238
|
+
result = self.engine.execute(sql, filter_db=filter_db)
|
239
239
|
schema = self.handle_after__call__(result)
|
240
240
|
|
241
241
|
# Cache.
|
242
|
-
if self.
|
243
|
-
self.
|
242
|
+
if self.engine._schema is None:
|
243
|
+
self.engine._schema = schema
|
244
244
|
else:
|
245
|
-
self.
|
245
|
+
self.engine._schema.update(schema)
|
246
246
|
|
247
247
|
return schema
|
248
248
|
|
@@ -301,9 +301,9 @@ class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rdb.Database']):
|
|
301
301
|
# Parameter.
|
302
302
|
if (
|
303
303
|
cache
|
304
|
-
and self.
|
304
|
+
and self.engine._schema is not None
|
305
305
|
):
|
306
|
-
schema = self.
|
306
|
+
schema = self.engine._schema
|
307
307
|
else:
|
308
308
|
schema = self.schema()
|
309
309
|
|
@@ -313,7 +313,7 @@ class DatabaseInformationSchema(DatabaseInformationSchemaSuper['rdb.Database']):
|
|
313
313
|
return result
|
314
314
|
|
315
315
|
|
316
|
-
class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['
|
316
|
+
class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rengine.DatabaseEngineAsync']):
|
317
317
|
"""
|
318
318
|
Asynchronous database information schema type.
|
319
319
|
"""
|
@@ -334,12 +334,12 @@ class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rdb.Databas
|
|
334
334
|
|
335
335
|
# Get.
|
336
336
|
sql, filter_db = self.handle_before__call__(filter_default)
|
337
|
-
result = await self.
|
337
|
+
result = await self.engine.execute(sql, filter_db=filter_db)
|
338
338
|
schema = self.handle_after__call__(result)
|
339
339
|
|
340
340
|
# Cache.
|
341
|
-
if self.
|
342
|
-
self.
|
341
|
+
if self.engine._schema is not None:
|
342
|
+
self.engine._schema.update(schema)
|
343
343
|
|
344
344
|
return schema
|
345
345
|
|
@@ -398,11 +398,11 @@ class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rdb.Databas
|
|
398
398
|
# Parameter.
|
399
399
|
if (
|
400
400
|
refresh
|
401
|
-
or self.
|
401
|
+
or self.engine._schema is None
|
402
402
|
):
|
403
403
|
schema = await self.schema()
|
404
404
|
else:
|
405
|
-
schema = self.
|
405
|
+
schema = self.engine._schema
|
406
406
|
|
407
407
|
# Judge.
|
408
408
|
result = self.handle_exist(schema, database, table, column)
|
@@ -410,7 +410,7 @@ class DatabaseInformationSchemaAsync(DatabaseInformationSchemaSuper['rdb.Databas
|
|
410
410
|
return result
|
411
411
|
|
412
412
|
|
413
|
-
class DatabaseInformationParameterSuper(DatabaseInformationBase, Generic[
|
413
|
+
class DatabaseInformationParameterSuper(DatabaseInformationBase, Generic[DatabaseEngineT]):
|
414
414
|
"""
|
415
415
|
Database information parameters super type.
|
416
416
|
"""
|
@@ -421,21 +421,21 @@ class DatabaseInformationParameterSuper(DatabaseInformationBase, Generic[Databas
|
|
421
421
|
|
422
422
|
def __init__(
|
423
423
|
self,
|
424
|
-
|
424
|
+
engine: DatabaseEngineT
|
425
425
|
) -> None:
|
426
426
|
"""
|
427
427
|
Build instance attributes.
|
428
428
|
|
429
429
|
Parameters
|
430
430
|
----------
|
431
|
-
|
431
|
+
engine: Database engine.
|
432
432
|
"""
|
433
433
|
|
434
434
|
# Parameter.
|
435
|
-
self.
|
435
|
+
self.engine = engine
|
436
436
|
|
437
437
|
|
438
|
-
class DatabaseInformationParameter(DatabaseInformationParameterSuper['
|
438
|
+
class DatabaseInformationParameter(DatabaseInformationParameterSuper['rengine.DatabaseEngine']):
|
439
439
|
"""
|
440
440
|
Database information parameters type.
|
441
441
|
"""
|
@@ -509,13 +509,13 @@ class DatabaseInformationParameter(DatabaseInformationParameterSuper['rdb.Databa
|
|
509
509
|
|
510
510
|
## Dictionary.
|
511
511
|
if key is None:
|
512
|
-
result = self.
|
512
|
+
result = self.engine.execute(sql, key=key)
|
513
513
|
status = result.to_dict(val_field=1)
|
514
514
|
|
515
515
|
## Value.
|
516
516
|
else:
|
517
517
|
sql += ' LIKE :key'
|
518
|
-
result = self.
|
518
|
+
result = self.engine.execute(sql, key=key)
|
519
519
|
row = result.first()
|
520
520
|
if row is None:
|
521
521
|
status = None
|
@@ -554,10 +554,10 @@ class DatabaseInformationParameter(DatabaseInformationParameterSuper['rdb.Databa
|
|
554
554
|
) + sql_set
|
555
555
|
|
556
556
|
# Execute SQL.
|
557
|
-
self.
|
557
|
+
self.engine.execute(sql)
|
558
558
|
|
559
559
|
|
560
|
-
class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['
|
560
|
+
class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rengine.DatabaseEngineAsync']):
|
561
561
|
"""
|
562
562
|
Asynchronous database information parameters type.
|
563
563
|
"""
|
@@ -631,13 +631,13 @@ class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.D
|
|
631
631
|
|
632
632
|
## Dictionary.
|
633
633
|
if key is None:
|
634
|
-
result = await self.
|
634
|
+
result = await self.engine.execute(sql, key=key)
|
635
635
|
status = result.to_dict(val_field=1)
|
636
636
|
|
637
637
|
## Value.
|
638
638
|
else:
|
639
639
|
sql += ' LIKE :key'
|
640
|
-
result = await self.
|
640
|
+
result = await self.engine.execute(sql, key=key)
|
641
641
|
row = result.first()
|
642
642
|
if row is None:
|
643
643
|
status = None
|
@@ -680,7 +680,7 @@ class DatabaseInformationParameterAsync(DatabaseInformationParameterSuper['rdb.D
|
|
680
680
|
) + sql_set
|
681
681
|
|
682
682
|
# Execute SQL.
|
683
|
-
await self.
|
683
|
+
await self.engine.execute(sql)
|
684
684
|
|
685
685
|
|
686
686
|
class DatabaseInformationParameterVariables(DatabaseInformationParameter):
|