reydb 1.1.60__py3-none-any.whl → 1.2.0__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 +0 -2
- reydb/rall.py +0 -2
- reydb/rbase.py +0 -48
- reydb/rbuild.py +129 -315
- reydb/rconfig.py +379 -42
- reydb/rdb.py +77 -84
- reydb/rerror.py +298 -109
- reydb/rexec.py +148 -168
- reydb/rorm.py +151 -120
- reydb/rparam.py +408 -68
- {reydb-1.1.60.dist-info → reydb-1.2.0.dist-info}/METADATA +1 -1
- reydb-1.2.0.dist-info/RECORD +15 -0
- reydb/rfile.py +0 -482
- reydb/rinfo.py +0 -499
- reydb-1.1.60.dist-info/RECORD +0 -17
- {reydb-1.1.60.dist-info → reydb-1.2.0.dist-info}/WHEEL +0 -0
- {reydb-1.1.60.dist-info → reydb-1.2.0.dist-info}/licenses/LICENSE +0 -0
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, rorm, rparam
|
20
20
|
|
21
21
|
|
22
22
|
__all__ = (
|
@@ -28,9 +28,14 @@ __all__ = (
|
|
28
28
|
|
29
29
|
DatabaseConnectionT = TypeVar('DatabaseConnectionT', 'rconn.DatabaseConnection', 'rconn.DatabaseConnectionAsync')
|
30
30
|
DatabaseExecuteT = TypeVar('DatabaseExecuteT', 'rexec.DatabaseExecute', 'rexec.DatabaseExecuteAsync')
|
31
|
-
DatabaseSchemaT = TypeVar('DatabaseSchemaT', 'rparam.DatabaseSchema', 'rparam.DatabaseSchemaAsync')
|
32
31
|
DatabaseORMT = TypeVar('DatabaseORMT', 'rorm.DatabaseORM', 'rorm.DatabaseORMAsync')
|
33
|
-
DatabaseBuildT = TypeVar('DatabaseBuildT')
|
32
|
+
DatabaseBuildT = TypeVar('DatabaseBuildT', 'rbuild.DatabaseBuild', 'rbuild.DatabaseBuildAsync')
|
33
|
+
DatabaseConfigT = TypeVar('DatabaseConfigT', 'rconfig.DatabaseConfig', 'rconfig.DatabaseConfigAsync')
|
34
|
+
DatabaseSchemaT = TypeVar('DatabaseSchemaT', 'rparam.DatabaseSchema', 'rparam.DatabaseSchemaAsync')
|
35
|
+
DatabaseParametersVariablesT = TypeVar('DatabaseParametersVariablesT', 'rparam.DatabaseParametersVariables', 'rparam.DatabaseParametersVariablesAsync')
|
36
|
+
DatabaseParametersStatusT = TypeVar('DatabaseParametersStatusT', 'rparam.DatabaseParametersStatus', 'rparam.DatabaseParametersStatusAsync')
|
37
|
+
DatabaseParametersVariablesGlobalT = TypeVar('DatabaseParametersVariablesGlobalT', 'rparam.DatabaseParametersVariablesGlobal', 'rparam.DatabaseParametersVariablesGlobalAsync')
|
38
|
+
DatabaseParametersStatusGlobalT = TypeVar('DatabaseParametersStatusGlobalT', 'rparam.DatabaseParametersStatusGlobal', 'rparam.DatabaseParametersStatusGlobalAsync')
|
34
39
|
|
35
40
|
|
36
41
|
class DatabaseSuper(
|
@@ -39,9 +44,14 @@ class DatabaseSuper(
|
|
39
44
|
rbase.EngineT,
|
40
45
|
DatabaseConnectionT,
|
41
46
|
DatabaseExecuteT,
|
42
|
-
DatabaseSchemaT,
|
43
47
|
DatabaseORMT,
|
44
|
-
DatabaseBuildT
|
48
|
+
DatabaseBuildT,
|
49
|
+
DatabaseConfigT,
|
50
|
+
DatabaseSchemaT,
|
51
|
+
DatabaseParametersVariablesT,
|
52
|
+
DatabaseParametersStatusT,
|
53
|
+
DatabaseParametersVariablesGlobalT,
|
54
|
+
DatabaseParametersStatusGlobalT
|
45
55
|
]
|
46
56
|
):
|
47
57
|
"""
|
@@ -103,6 +113,9 @@ class DatabaseSuper(
|
|
103
113
|
self.report = report
|
104
114
|
self.query = query
|
105
115
|
|
116
|
+
## Schema.
|
117
|
+
self._schema: dict[str, dict[str, list[str]]] | None = None
|
118
|
+
|
106
119
|
## Create engine.
|
107
120
|
self.engine = self.__create_engine()
|
108
121
|
|
@@ -326,22 +339,6 @@ class DatabaseSuper(
|
|
326
339
|
return build
|
327
340
|
|
328
341
|
|
329
|
-
@property
|
330
|
-
def file(self):
|
331
|
-
"""
|
332
|
-
Build database file instance.
|
333
|
-
|
334
|
-
Returns
|
335
|
-
-------
|
336
|
-
Instance.
|
337
|
-
"""
|
338
|
-
|
339
|
-
# Build.
|
340
|
-
dbfile = rfile.DatabaseFile(self)
|
341
|
-
|
342
|
-
return dbfile
|
343
|
-
|
344
|
-
|
345
342
|
@property
|
346
343
|
def error(self):
|
347
344
|
"""
|
@@ -353,13 +350,17 @@ class DatabaseSuper(
|
|
353
350
|
"""
|
354
351
|
|
355
352
|
# Build.
|
356
|
-
|
353
|
+
match self:
|
354
|
+
case Database():
|
355
|
+
error = rerror.DatabaseError(self)
|
356
|
+
case DatabaseAsync():
|
357
|
+
error = rerror.DatabaseErrorAsync(self)
|
357
358
|
|
358
|
-
return
|
359
|
+
return error
|
359
360
|
|
360
361
|
|
361
362
|
@property
|
362
|
-
def config(self):
|
363
|
+
def config(self) -> DatabaseConfigT:
|
363
364
|
"""
|
364
365
|
Build database config instance.
|
365
366
|
|
@@ -369,45 +370,13 @@ class DatabaseSuper(
|
|
369
370
|
"""
|
370
371
|
|
371
372
|
# Build.
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
@property
|
378
|
-
def info(self):
|
379
|
-
"""
|
380
|
-
Build database information schema instance.
|
381
|
-
|
382
|
-
Returns
|
383
|
-
-------
|
384
|
-
Instance.
|
385
|
-
|
386
|
-
Examples
|
387
|
-
--------
|
388
|
-
Get databases information of server.
|
389
|
-
>>> databases_info = DatabaseInformationSchema()
|
390
|
-
|
391
|
-
Get tables information of database.
|
392
|
-
>>> tables_info = DatabaseInformationSchema.database()
|
393
|
-
|
394
|
-
Get columns information of table.
|
395
|
-
>>> columns_info = DatabaseInformationSchema.database.table()
|
396
|
-
|
397
|
-
Get database attribute.
|
398
|
-
>>> database_attr = DatabaseInformationSchema.database['attribute']
|
399
|
-
|
400
|
-
Get table attribute.
|
401
|
-
>>> database_attr = DatabaseInformationSchema.database.table['attribute']
|
402
|
-
|
403
|
-
Get column attribute.
|
404
|
-
>>> database_attr = DatabaseInformationSchema.database.table.column['attribute']
|
405
|
-
"""
|
406
|
-
|
407
|
-
# Build.
|
408
|
-
dbischema = rinfo.DatabaseInformationSchema(self)
|
373
|
+
match self:
|
374
|
+
case Database():
|
375
|
+
config = rconfig.DatabaseConfig(self)
|
376
|
+
case DatabaseAsync():
|
377
|
+
config = rconfig.DatabaseConfigAsync(self)
|
409
378
|
|
410
|
-
return
|
379
|
+
return config
|
411
380
|
|
412
381
|
|
413
382
|
@property
|
@@ -431,9 +400,9 @@ class DatabaseSuper(
|
|
431
400
|
|
432
401
|
|
433
402
|
@property
|
434
|
-
def
|
403
|
+
def var(self) -> DatabaseParametersVariablesT:
|
435
404
|
"""
|
436
|
-
Build database parameters
|
405
|
+
Build database parameters variable instance.
|
437
406
|
|
438
407
|
Returns
|
439
408
|
-------
|
@@ -441,15 +410,19 @@ class DatabaseSuper(
|
|
441
410
|
"""
|
442
411
|
|
443
412
|
# Build.
|
444
|
-
|
413
|
+
match self:
|
414
|
+
case Database():
|
415
|
+
var = rparam.DatabaseParametersVariables(self)
|
416
|
+
case DatabaseAsync():
|
417
|
+
var = rparam.DatabaseParametersVariablesAsync(self)
|
445
418
|
|
446
|
-
return
|
419
|
+
return var
|
447
420
|
|
448
421
|
|
449
422
|
@property
|
450
|
-
def
|
423
|
+
def stat(self) -> DatabaseParametersVariablesT:
|
451
424
|
"""
|
452
|
-
Build
|
425
|
+
Build database parameters status instance.
|
453
426
|
|
454
427
|
Returns
|
455
428
|
-------
|
@@ -457,15 +430,19 @@ class DatabaseSuper(
|
|
457
430
|
"""
|
458
431
|
|
459
432
|
# Build.
|
460
|
-
|
433
|
+
match self:
|
434
|
+
case Database():
|
435
|
+
stat = rparam.DatabaseParametersStatus(self)
|
436
|
+
case DatabaseAsync():
|
437
|
+
stat = rparam.DatabaseParametersStatusAsync(self)
|
461
438
|
|
462
|
-
return
|
439
|
+
return stat
|
463
440
|
|
464
441
|
|
465
442
|
@property
|
466
|
-
def
|
443
|
+
def glob_var(self) -> DatabaseParametersVariablesGlobalT:
|
467
444
|
"""
|
468
|
-
Build database parameters variable instance.
|
445
|
+
Build global database parameters variable instance.
|
469
446
|
|
470
447
|
Returns
|
471
448
|
-------
|
@@ -473,15 +450,19 @@ class DatabaseSuper(
|
|
473
450
|
"""
|
474
451
|
|
475
452
|
# Build.
|
476
|
-
|
453
|
+
match self:
|
454
|
+
case Database():
|
455
|
+
var = rparam.DatabaseParametersVariablesGlobal(self)
|
456
|
+
case DatabaseAsync():
|
457
|
+
var = rparam.DatabaseParametersVariablesGlobalAsync(self)
|
477
458
|
|
478
|
-
return
|
459
|
+
return var
|
479
460
|
|
480
461
|
|
481
462
|
@property
|
482
|
-
def
|
463
|
+
def glob_stat(self) -> DatabaseParametersStatusGlobalT:
|
483
464
|
"""
|
484
|
-
Build global database parameters
|
465
|
+
Build global database parameters status instance.
|
485
466
|
|
486
467
|
Returns
|
487
468
|
-------
|
@@ -489,11 +470,13 @@ class DatabaseSuper(
|
|
489
470
|
"""
|
490
471
|
|
491
472
|
# Build.
|
473
|
+
match self:
|
474
|
+
case Database():
|
475
|
+
stat = rparam.DatabaseParametersStatusGlobal(self)
|
476
|
+
case DatabaseAsync():
|
477
|
+
stat = rparam.DatabaseParametersStatusGlobalAsync(self)
|
492
478
|
|
493
|
-
|
494
|
-
dbpv = rparam.DatabaseParametersVariable(self, True)
|
495
|
-
|
496
|
-
return dbpv
|
479
|
+
return stat
|
497
480
|
|
498
481
|
|
499
482
|
class Database(
|
@@ -501,9 +484,14 @@ class Database(
|
|
501
484
|
Engine,
|
502
485
|
'rconn.DatabaseConnection',
|
503
486
|
'rexec.DatabaseExecute',
|
504
|
-
'rparam.DatabaseSchema',
|
505
487
|
'rorm.DatabaseORM',
|
506
|
-
'rbuild.DatabaseBuild'
|
488
|
+
'rbuild.DatabaseBuild',
|
489
|
+
'rconfig.DatabaseConfig',
|
490
|
+
'rparam.DatabaseSchema',
|
491
|
+
'rparam.DatabaseParametersVariables',
|
492
|
+
'rparam.DatabaseParametersStatus',
|
493
|
+
'rparam.DatabaseParametersVariablesGlobal',
|
494
|
+
'rparam.DatabaseParametersStatusGlobal'
|
507
495
|
]
|
508
496
|
):
|
509
497
|
"""
|
@@ -516,9 +504,14 @@ class DatabaseAsync(
|
|
516
504
|
AsyncEngine,
|
517
505
|
'rconn.DatabaseConnectionAsync',
|
518
506
|
'rexec.DatabaseExecuteAsync',
|
519
|
-
'rparam.DatabaseSchemaAsync',
|
520
507
|
'rorm.DatabaseORMAsync',
|
521
|
-
'rbuild.DatabaseBuildAsync'
|
508
|
+
'rbuild.DatabaseBuildAsync',
|
509
|
+
'rconfig.DatabaseConfigAsync',
|
510
|
+
'rparam.DatabaseSchemaAsync',
|
511
|
+
'rparam.DatabaseParametersVariablesAsync',
|
512
|
+
'rparam.DatabaseParametersStatusAsync',
|
513
|
+
'rparam.DatabaseParametersVariablesGlobalAsync',
|
514
|
+
'rparam.DatabaseParametersStatusGlobalAsync'
|
522
515
|
]
|
523
516
|
):
|
524
517
|
"""
|