reydb 1.1.49__py3-none-any.whl → 1.1.51__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 -0
- reydb/rall.py +1 -0
- reydb/rbuild.py +24 -25
- reydb/rconfig.py +16 -13
- reydb/rconn.py +24 -25
- reydb/rdb.py +65 -44
- reydb/rerror.py +6 -7
- reydb/rexec.py +1 -1
- reydb/rfile.py +7 -9
- reydb/rinfo.py +58 -60
- reydb/rorm.py +567 -0
- reydb/rparam.py +13 -14
- {reydb-1.1.49.dist-info → reydb-1.1.51.dist-info}/METADATA +1 -1
- reydb-1.1.51.dist-info/RECORD +17 -0
- reydb-1.1.49.dist-info/RECORD +0 -16
- {reydb-1.1.49.dist-info → reydb-1.1.51.dist-info}/WHEEL +0 -0
- {reydb-1.1.49.dist-info → reydb-1.1.51.dist-info}/licenses/LICENSE +0 -0
reydb/rinfo.py
CHANGED
@@ -11,10 +11,8 @@
|
|
11
11
|
|
12
12
|
from __future__ import annotations
|
13
13
|
from typing import Any, Literal, overload
|
14
|
-
from reykit.rbase import throw
|
15
14
|
|
16
15
|
from .rbase import DatabaseBase
|
17
|
-
from .rconn import DatabaseConnection
|
18
16
|
from .rdb import Database
|
19
17
|
|
20
18
|
|
@@ -151,11 +149,11 @@ class DatabaseInformation(DatabaseBase):
|
|
151
149
|
# Build.
|
152
150
|
match self:
|
153
151
|
case DatabaseInformationSchema():
|
154
|
-
table = DatabaseInformationDatabase(self.
|
152
|
+
table = DatabaseInformationDatabase(self.db, name)
|
155
153
|
case DatabaseInformationDatabase():
|
156
|
-
table = DatabaseInformationTable(self.
|
154
|
+
table = DatabaseInformationTable(self.db, self.database, name)
|
157
155
|
case DatabaseInformationTable():
|
158
|
-
table = DatabaseInformationColumn(self.
|
156
|
+
table = DatabaseInformationColumn(self.db, self.database, self.table, name)
|
159
157
|
case _:
|
160
158
|
raise AssertionError("class '%s' does not have this method" % type(self).__name__)
|
161
159
|
|
@@ -193,18 +191,18 @@ class DatabaseInformationSchema(DatabaseInformation):
|
|
193
191
|
|
194
192
|
def __init__(
|
195
193
|
self,
|
196
|
-
|
194
|
+
db: Database
|
197
195
|
) -> None:
|
198
196
|
"""
|
199
197
|
Build instance attributes.
|
200
198
|
|
201
199
|
Parameters
|
202
200
|
----------
|
203
|
-
|
201
|
+
db: `Database` instance.
|
204
202
|
"""
|
205
203
|
|
206
204
|
# Set parameter.
|
207
|
-
self.
|
205
|
+
self.db = db
|
208
206
|
|
209
207
|
|
210
208
|
def _get_info_table(self) -> list[dict]:
|
@@ -217,7 +215,7 @@ class DatabaseInformationSchema(DatabaseInformation):
|
|
217
215
|
"""
|
218
216
|
|
219
217
|
# Select.
|
220
|
-
result = self.
|
218
|
+
result = self.db.execute.select(
|
221
219
|
'information_schema.SCHEMATA',
|
222
220
|
order='`schema_name`'
|
223
221
|
)
|
@@ -256,21 +254,21 @@ class DatabaseInformationDatabase(DatabaseInformation):
|
|
256
254
|
|
257
255
|
def __init__(
|
258
256
|
self,
|
259
|
-
|
260
|
-
|
257
|
+
db: Database,
|
258
|
+
database: str
|
261
259
|
) -> None:
|
262
260
|
"""
|
263
261
|
Build instance attributes.
|
264
262
|
|
265
263
|
Parameters
|
266
264
|
----------
|
267
|
-
|
268
|
-
|
265
|
+
db: `Database` instance.
|
266
|
+
database : Database name.
|
269
267
|
"""
|
270
268
|
|
271
269
|
# Set parameter.
|
272
|
-
self.
|
273
|
-
self.
|
270
|
+
self.db = db
|
271
|
+
self.database = database
|
274
272
|
|
275
273
|
|
276
274
|
def _get_info_attrs(self) -> dict:
|
@@ -283,19 +281,19 @@ class DatabaseInformationDatabase(DatabaseInformation):
|
|
283
281
|
"""
|
284
282
|
|
285
283
|
# Select.
|
286
|
-
where = '`SCHEMA_NAME` = :
|
287
|
-
result = self.
|
284
|
+
where = '`SCHEMA_NAME` = :database'
|
285
|
+
result = self.db.execute.select(
|
288
286
|
'information_schema.SCHEMATA',
|
289
287
|
where=where,
|
290
288
|
limit=1,
|
291
|
-
|
289
|
+
database=self.database
|
292
290
|
)
|
293
291
|
|
294
292
|
# Convert.
|
295
293
|
info_table = result.to_table()
|
296
294
|
|
297
295
|
## Check.
|
298
|
-
assert len(info_table) != 0, "database '%s' not exist" % self.
|
296
|
+
assert len(info_table) != 0, "database '%s' not exist" % self.database
|
299
297
|
|
300
298
|
info_attrs = info_table[0]
|
301
299
|
|
@@ -312,19 +310,19 @@ class DatabaseInformationDatabase(DatabaseInformation):
|
|
312
310
|
"""
|
313
311
|
|
314
312
|
# Select.
|
315
|
-
where = '`TABLE_SCHEMA` = :
|
316
|
-
result = self.
|
313
|
+
where = '`TABLE_SCHEMA` = :database'
|
314
|
+
result = self.db.execute.select(
|
317
315
|
'information_schema.TABLES',
|
318
316
|
where=where,
|
319
317
|
order='`TABLE_NAME`',
|
320
|
-
|
318
|
+
database=self.database
|
321
319
|
)
|
322
320
|
|
323
321
|
# Convert.
|
324
322
|
info_table = result.to_table()
|
325
323
|
|
326
324
|
## Check.
|
327
|
-
assert len(info_table) != 0, "database '%s' not exist" % self.
|
325
|
+
assert len(info_table) != 0, "database '%s' not exist" % self.database
|
328
326
|
|
329
327
|
return info_table
|
330
328
|
|
@@ -351,24 +349,24 @@ class DatabaseInformationTable(DatabaseInformation):
|
|
351
349
|
|
352
350
|
def __init__(
|
353
351
|
self,
|
354
|
-
|
355
|
-
|
356
|
-
|
352
|
+
db: Database,
|
353
|
+
database: str,
|
354
|
+
table: str
|
357
355
|
) -> None:
|
358
356
|
"""
|
359
357
|
Build instance attributes.
|
360
358
|
|
361
359
|
Parameters
|
362
360
|
----------
|
363
|
-
|
364
|
-
|
365
|
-
|
361
|
+
db: `Database` instance.
|
362
|
+
database : Database name.
|
363
|
+
table : Table name.
|
366
364
|
"""
|
367
365
|
|
368
366
|
# Set parameter.
|
369
|
-
self.
|
370
|
-
self.
|
371
|
-
self.
|
367
|
+
self.db = db
|
368
|
+
self.database = database
|
369
|
+
self.table = table
|
372
370
|
|
373
371
|
|
374
372
|
def _get_info_attrs(self) -> dict:
|
@@ -381,20 +379,20 @@ class DatabaseInformationTable(DatabaseInformation):
|
|
381
379
|
"""
|
382
380
|
|
383
381
|
# Select.
|
384
|
-
where = '`TABLE_SCHEMA` = :
|
385
|
-
result = self.
|
382
|
+
where = '`TABLE_SCHEMA` = :database AND `TABLE_NAME` = :table_'
|
383
|
+
result = self.db.execute.select(
|
386
384
|
'information_schema.TABLES',
|
387
385
|
where=where,
|
388
386
|
limit=1,
|
389
|
-
|
390
|
-
|
387
|
+
database=self.database,
|
388
|
+
table_=self.table
|
391
389
|
)
|
392
390
|
|
393
391
|
# Convert.
|
394
392
|
info_table = result.to_table()
|
395
393
|
|
396
394
|
## Check.
|
397
|
-
assert len(info_table) != 0, "database '%s' or table '%s' not exist" % (self.
|
395
|
+
assert len(info_table) != 0, "database '%s' or table '%s' not exist" % (self.database, self.table)
|
398
396
|
|
399
397
|
info_attrs = info_table[0]
|
400
398
|
|
@@ -411,20 +409,20 @@ class DatabaseInformationTable(DatabaseInformation):
|
|
411
409
|
"""
|
412
410
|
|
413
411
|
# Select.
|
414
|
-
where = '`TABLE_SCHEMA` = :
|
415
|
-
result = self.
|
412
|
+
where = '`TABLE_SCHEMA` = :database AND `TABLE_NAME` = :table_'
|
413
|
+
result = self.db.execute.select(
|
416
414
|
'information_schema.COLUMNS',
|
417
415
|
where=where,
|
418
416
|
order='`ORDINAL_POSITION`',
|
419
|
-
|
420
|
-
|
417
|
+
database=self.database,
|
418
|
+
table_=self.table
|
421
419
|
)
|
422
420
|
|
423
421
|
# Convert.
|
424
422
|
info_table = result.to_table()
|
425
423
|
|
426
424
|
## Check.
|
427
|
-
assert len(info_table) != 0, "database '%s' or table '%s' not exist" % (self.
|
425
|
+
assert len(info_table) != 0, "database '%s' or table '%s' not exist" % (self.database, self.table)
|
428
426
|
|
429
427
|
return info_table
|
430
428
|
|
@@ -445,27 +443,27 @@ class DatabaseInformationColumn(DatabaseInformation):
|
|
445
443
|
|
446
444
|
def __init__(
|
447
445
|
self,
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
446
|
+
db: Database,
|
447
|
+
database: str,
|
448
|
+
table: str,
|
449
|
+
column: str
|
452
450
|
) -> None:
|
453
451
|
"""
|
454
452
|
Build instance attributes.
|
455
453
|
|
456
454
|
Parameters
|
457
455
|
----------
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
456
|
+
db: `Database` instance.
|
457
|
+
database : Database name.
|
458
|
+
table : Table name.
|
459
|
+
column : Column name.
|
462
460
|
"""
|
463
461
|
|
464
462
|
# Set parameter.
|
465
|
-
self.
|
466
|
-
self.
|
467
|
-
self.
|
468
|
-
self.
|
463
|
+
self.db = db
|
464
|
+
self.database = database
|
465
|
+
self.table = table
|
466
|
+
self.column = column
|
469
467
|
|
470
468
|
|
471
469
|
def _get_info_attrs(self) -> dict:
|
@@ -478,21 +476,21 @@ class DatabaseInformationColumn(DatabaseInformation):
|
|
478
476
|
"""
|
479
477
|
|
480
478
|
# Select.
|
481
|
-
where = '`TABLE_SCHEMA` = :
|
482
|
-
result = self.
|
479
|
+
where = '`TABLE_SCHEMA` = :database AND `TABLE_NAME` = :table_ AND `COLUMN_NAME` = :column'
|
480
|
+
result = self.db.execute.select(
|
483
481
|
'information_schema.COLUMNS',
|
484
482
|
where=where,
|
485
483
|
limit=1,
|
486
|
-
|
487
|
-
|
488
|
-
|
484
|
+
database=self.database,
|
485
|
+
table_=self.table,
|
486
|
+
column=self.column
|
489
487
|
)
|
490
488
|
|
491
489
|
# Convert.
|
492
490
|
info_table = result.to_table()
|
493
491
|
|
494
492
|
## Check.
|
495
|
-
assert len(info_table) != 0, "database '%s' or table '%s' or column '%s' not exist" % (self.
|
493
|
+
assert len(info_table) != 0, "database '%s' or table '%s' or column '%s' not exist" % (self.database, self.table, self.column)
|
496
494
|
|
497
495
|
info_attrs = info_table[0]
|
498
496
|
|