reydb 1.1.57__py3-none-any.whl → 1.1.59__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/rbase.py +11 -1
- reydb/rbuild.py +1 -1
- reydb/rconfig.py +3 -2
- reydb/rconn.py +66 -66
- reydb/rdb.py +94 -116
- reydb/rerror.py +1 -1
- reydb/rexec.py +5 -5
- reydb/rfile.py +1 -1
- reydb/rinfo.py +4 -4
- reydb/rorm.py +732 -166
- reydb/rparam.py +164 -81
- {reydb-1.1.57.dist-info → reydb-1.1.59.dist-info}/METADATA +2 -1
- reydb-1.1.59.dist-info/RECORD +17 -0
- reydb-1.1.57.dist-info/RECORD +0 -17
- {reydb-1.1.57.dist-info → reydb-1.1.59.dist-info}/WHEEL +0 -0
- {reydb-1.1.57.dist-info → reydb-1.1.59.dist-info}/licenses/LICENSE +0 -0
reydb/rbase.py
CHANGED
@@ -12,7 +12,8 @@
|
|
12
12
|
from typing import Any, TypedDict, Literal, TypeVar
|
13
13
|
from enum import EnumType
|
14
14
|
from sqlalchemy import Engine, Connection, Transaction, text as sqlalchemy_text
|
15
|
-
from sqlalchemy.
|
15
|
+
from sqlalchemy.orm import Session, SessionTransaction
|
16
|
+
from sqlalchemy.ext.asyncio import AsyncEngine, AsyncConnection, AsyncTransaction, AsyncSession, AsyncSessionTransaction
|
16
17
|
from sqlalchemy.engine.url import URL
|
17
18
|
from sqlalchemy.sql.elements import TextClause
|
18
19
|
from reykit.rbase import Base, throw
|
@@ -36,9 +37,18 @@ __all__ = (
|
|
36
37
|
EngineT = TypeVar('EngineT', Engine, AsyncEngine)
|
37
38
|
ConnectionT = TypeVar('ConnectionT', Connection, AsyncConnection)
|
38
39
|
TransactionT = TypeVar('TransactionT', Transaction, AsyncTransaction)
|
40
|
+
SessionT = TypeVar('SessionT', Session, AsyncSession)
|
41
|
+
SessionTransactionT = TypeVar('SessionTransactionT', SessionTransaction, AsyncSessionTransaction)
|
39
42
|
DatabaseT = TypeVar('DatabaseT')
|
40
43
|
DatabaseConnectionT = TypeVar('DatabaseConnectionT')
|
41
44
|
DatabaseExecuteT = TypeVar('DatabaseExecuteT')
|
45
|
+
DatabaseSchemaT = TypeVar('DatabaseSchemaT')
|
46
|
+
DatabaseORMT = TypeVar('DatabaseORMT')
|
47
|
+
DatabaseORMSessionT = TypeVar('DatabaseSessionT')
|
48
|
+
DatabaseORMStatementSelectT = TypeVar('DatabaseORMStatementSelectT')
|
49
|
+
DatabaseORMStatementInsertT = TypeVar('DatabaseORMStatementInsertT')
|
50
|
+
DatabaseORMStatementUpdateT = TypeVar('DatabaseORMStatementUpdateT')
|
51
|
+
DatabaseORMStatementDeleteT = TypeVar('DatabaseORMStatementDeleteT')
|
42
52
|
|
43
53
|
|
44
54
|
URLParameters = TypedDict(
|
reydb/rbuild.py
CHANGED
reydb/rconfig.py
CHANGED
@@ -20,6 +20,7 @@ from datetime import (
|
|
20
20
|
from reykit.rbase import Null, throw
|
21
21
|
|
22
22
|
from . import rdb
|
23
|
+
from .rbase import DatabaseBase
|
23
24
|
|
24
25
|
|
25
26
|
__all__ = (
|
@@ -33,7 +34,7 @@ type ConfigTable = list[ConfigRow]
|
|
33
34
|
ConfigValueT = TypeVar('T', bound=ConfigValue) # Any.
|
34
35
|
|
35
36
|
|
36
|
-
class DatabaseConfig(
|
37
|
+
class DatabaseConfig(DatabaseBase):
|
37
38
|
"""
|
38
39
|
Database config type.
|
39
40
|
Can create database used `self.build_db` method.
|
@@ -54,7 +55,7 @@ class DatabaseConfig(object):
|
|
54
55
|
|
55
56
|
Parameters
|
56
57
|
----------
|
57
|
-
db:
|
58
|
+
db: Database instance.
|
58
59
|
"""
|
59
60
|
|
60
61
|
# Build.
|
reydb/rconn.py
CHANGED
@@ -40,7 +40,7 @@ class DatabaseConnectionSuper(DatabaseBase, Generic[DatabaseT, DatabaseExecuteT,
|
|
40
40
|
|
41
41
|
Parameters
|
42
42
|
----------
|
43
|
-
db :
|
43
|
+
db : Database instance.
|
44
44
|
autocommit: Whether automatic commit execute.
|
45
45
|
"""
|
46
46
|
|
@@ -63,6 +63,39 @@ class DatabaseConnection(DatabaseConnectionSuper['rdb.Database', 'rexec.Database
|
|
63
63
|
"""
|
64
64
|
|
65
65
|
|
66
|
+
def __enter__(self) -> Self:
|
67
|
+
"""
|
68
|
+
Enter syntax `with`.
|
69
|
+
|
70
|
+
Returns
|
71
|
+
-------
|
72
|
+
Self.
|
73
|
+
"""
|
74
|
+
|
75
|
+
return self
|
76
|
+
|
77
|
+
|
78
|
+
def __exit__(
|
79
|
+
self,
|
80
|
+
exc_type: type[BaseException] | None,
|
81
|
+
*_
|
82
|
+
) -> None:
|
83
|
+
"""
|
84
|
+
Exit syntax `with`.
|
85
|
+
|
86
|
+
Parameters
|
87
|
+
----------
|
88
|
+
exc_type : Exception type.
|
89
|
+
"""
|
90
|
+
|
91
|
+
# Commit.
|
92
|
+
if exc_type is None:
|
93
|
+
self.commit()
|
94
|
+
|
95
|
+
# Close.
|
96
|
+
self.close()
|
97
|
+
|
98
|
+
|
66
99
|
def get_conn(self) -> Connection:
|
67
100
|
"""
|
68
101
|
Get `Connection` instance.
|
@@ -132,9 +165,32 @@ class DatabaseConnection(DatabaseConnectionSuper['rdb.Database', 'rexec.Database
|
|
132
165
|
self.conn = None
|
133
166
|
|
134
167
|
|
135
|
-
def
|
168
|
+
def insert_id(self) -> int:
|
136
169
|
"""
|
137
|
-
|
170
|
+
Return last self increasing ID.
|
171
|
+
|
172
|
+
Returns
|
173
|
+
-------
|
174
|
+
ID.
|
175
|
+
"""
|
176
|
+
|
177
|
+
# Get.
|
178
|
+
sql = 'SELECT LAST_INSERT_ID()'
|
179
|
+
result = self.execute(sql)
|
180
|
+
insert_id = result.scalar()
|
181
|
+
|
182
|
+
return insert_id
|
183
|
+
|
184
|
+
|
185
|
+
class DatabaseConnectionAsync(DatabaseConnectionSuper['rdb.DatabaseAsync', 'rexec.DatabaseExecuteAsync', AsyncConnection, AsyncTransaction]):
|
186
|
+
"""
|
187
|
+
Asynchronous database connection type.
|
188
|
+
"""
|
189
|
+
|
190
|
+
|
191
|
+
async def __aenter__(self):
|
192
|
+
"""
|
193
|
+
Asynchronous enter syntax `async with`.
|
138
194
|
|
139
195
|
Returns
|
140
196
|
-------
|
@@ -144,13 +200,13 @@ class DatabaseConnection(DatabaseConnectionSuper['rdb.Database', 'rexec.Database
|
|
144
200
|
return self
|
145
201
|
|
146
202
|
|
147
|
-
def
|
203
|
+
async def __aexit__(
|
148
204
|
self,
|
149
205
|
exc_type: type[BaseException] | None,
|
150
206
|
*_
|
151
207
|
) -> None:
|
152
208
|
"""
|
153
|
-
|
209
|
+
Asynchronous exit syntax `async with`.
|
154
210
|
|
155
211
|
Parameters
|
156
212
|
----------
|
@@ -159,38 +215,16 @@ class DatabaseConnection(DatabaseConnectionSuper['rdb.Database', 'rexec.Database
|
|
159
215
|
|
160
216
|
# Commit.
|
161
217
|
if exc_type is None:
|
162
|
-
self.commit()
|
218
|
+
await self.commit()
|
163
219
|
|
164
220
|
# Close.
|
165
|
-
self.close()
|
166
|
-
|
167
|
-
|
168
|
-
def insert_id(self) -> int:
|
169
|
-
"""
|
170
|
-
Return last self increasing ID.
|
171
|
-
|
172
|
-
Returns
|
173
|
-
-------
|
174
|
-
ID.
|
175
|
-
"""
|
176
|
-
|
177
|
-
# Get.
|
178
|
-
sql = 'SELECT LAST_INSERT_ID()'
|
179
|
-
result = self.execute(sql)
|
180
|
-
insert_id = result.scalar()
|
181
|
-
|
182
|
-
return insert_id
|
183
|
-
|
184
|
-
|
185
|
-
class DatabaseConnectionAsync(DatabaseConnectionSuper['rdb.DatabaseAsync', 'rexec.DatabaseExecuteAsync', AsyncConnection, AsyncTransaction]):
|
186
|
-
"""
|
187
|
-
Asynchronous database connection type.
|
188
|
-
"""
|
221
|
+
await self.close()
|
222
|
+
await self.db.dispose()
|
189
223
|
|
190
224
|
|
191
225
|
async def get_conn(self) -> AsyncConnection:
|
192
226
|
"""
|
193
|
-
Asynchronous get `
|
227
|
+
Asynchronous get `AsyncConnection` instance.
|
194
228
|
|
195
229
|
Returns
|
196
230
|
-------
|
@@ -206,7 +240,7 @@ class DatabaseConnectionAsync(DatabaseConnectionSuper['rdb.DatabaseAsync', 'rexe
|
|
206
240
|
|
207
241
|
async def get_begin(self) -> AsyncTransaction:
|
208
242
|
"""
|
209
|
-
Asynchronous get `
|
243
|
+
Asynchronous get `AsyncTransaction` instance.
|
210
244
|
|
211
245
|
Returns
|
212
246
|
-------
|
@@ -257,40 +291,6 @@ class DatabaseConnectionAsync(DatabaseConnectionSuper['rdb.DatabaseAsync', 'rexe
|
|
257
291
|
self.conn = None
|
258
292
|
|
259
293
|
|
260
|
-
async def __aenter__(self):
|
261
|
-
"""
|
262
|
-
Asynchronous enter syntax `async with`.
|
263
|
-
|
264
|
-
Returns
|
265
|
-
-------
|
266
|
-
Self.
|
267
|
-
"""
|
268
|
-
|
269
|
-
return self
|
270
|
-
|
271
|
-
|
272
|
-
async def __aexit__(
|
273
|
-
self,
|
274
|
-
exc_type: type[BaseException] | None,
|
275
|
-
*_
|
276
|
-
) -> None:
|
277
|
-
"""
|
278
|
-
Asynchronous exit syntax `async with`.
|
279
|
-
|
280
|
-
Parameters
|
281
|
-
----------
|
282
|
-
exc_type : Exception type.
|
283
|
-
"""
|
284
|
-
|
285
|
-
# Commit.
|
286
|
-
if exc_type is None:
|
287
|
-
await self.commit()
|
288
|
-
|
289
|
-
# Close.
|
290
|
-
await self.close()
|
291
|
-
await self.db.dispose()
|
292
|
-
|
293
|
-
|
294
294
|
async def insert_id(self) -> int:
|
295
295
|
"""
|
296
296
|
Asynchronous return last self increasing ID.
|
reydb/rdb.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Generic
|
12
|
+
from typing import TypeVar, Generic
|
13
13
|
from urllib.parse import quote as urllib_quote
|
14
14
|
from pymysql.constants.CLIENT import MULTI_STATEMENTS
|
15
15
|
from sqlalchemy import Engine, create_engine as sqlalchemy_create_engine
|
@@ -21,12 +21,21 @@ from . import rbase, rbuild, rconfig, rconn, rerror, rexec, rfile, rinfo, rorm,
|
|
21
21
|
|
22
22
|
__all__ = (
|
23
23
|
'DatabaseSuper',
|
24
|
-
'
|
25
|
-
'
|
24
|
+
'Database',
|
25
|
+
'DatabaseAsync'
|
26
26
|
)
|
27
27
|
|
28
28
|
|
29
|
-
class DatabaseSuper(
|
29
|
+
class DatabaseSuper(
|
30
|
+
rbase.DatabaseBase,
|
31
|
+
Generic[
|
32
|
+
rbase.EngineT,
|
33
|
+
rbase.DatabaseConnectionT,
|
34
|
+
rbase.DatabaseExecuteT,
|
35
|
+
rbase.DatabaseSchemaT,
|
36
|
+
rbase.DatabaseORMT
|
37
|
+
]
|
38
|
+
):
|
30
39
|
"""
|
31
40
|
Database super type, based `MySQL`.
|
32
41
|
"""
|
@@ -108,7 +117,6 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
108
117
|
if key not in filter_key
|
109
118
|
}
|
110
119
|
info['conn_count'] = self.conn_count
|
111
|
-
info['aconn_count'] = self.aconn_count
|
112
120
|
text = join_data_text(info)
|
113
121
|
|
114
122
|
return text
|
@@ -230,76 +238,6 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
230
238
|
return keep_n, overflow_n
|
231
239
|
|
232
240
|
|
233
|
-
def schema(self, filter_default: bool = True) -> dict[str, dict[str, list[str]]]:
|
234
|
-
"""
|
235
|
-
Get schemata of databases and tables and columns.
|
236
|
-
|
237
|
-
Parameters
|
238
|
-
----------
|
239
|
-
filter_default : Whether filter default database.
|
240
|
-
|
241
|
-
Returns
|
242
|
-
-------
|
243
|
-
Schemata of databases and tables and columns.
|
244
|
-
"""
|
245
|
-
|
246
|
-
# Handle parameter.
|
247
|
-
filter_db = (
|
248
|
-
'information_schema',
|
249
|
-
'performance_schema',
|
250
|
-
'mysql',
|
251
|
-
'sys'
|
252
|
-
)
|
253
|
-
if filter_default:
|
254
|
-
where_database = 'WHERE `SCHEMA_NAME` NOT IN :filter_db\n'
|
255
|
-
where_column = ' WHERE `TABLE_SCHEMA` NOT IN :filter_db\n'
|
256
|
-
else:
|
257
|
-
where_database = where_column = ''
|
258
|
-
|
259
|
-
# Select.
|
260
|
-
sql = (
|
261
|
-
'SELECT GROUP_CONCAT(`SCHEMA_NAME`) AS `TABLE_SCHEMA`, NULL AS `TABLE_NAME`, NULL AS `COLUMN_NAME`\n'
|
262
|
-
'FROM `information_schema`.`SCHEMATA`\n'
|
263
|
-
f'{where_database}'
|
264
|
-
'UNION ALL (\n'
|
265
|
-
' SELECT `TABLE_SCHEMA`, `TABLE_NAME`, `COLUMN_NAME`\n'
|
266
|
-
' FROM `information_schema`.`COLUMNS`\n'
|
267
|
-
f'{where_column}'
|
268
|
-
' ORDER BY `TABLE_SCHEMA`, `TABLE_NAME`, `ORDINAL_POSITION`\n'
|
269
|
-
')'
|
270
|
-
)
|
271
|
-
result = self.execute(sql, filter_db=filter_db)
|
272
|
-
|
273
|
-
# Convert.
|
274
|
-
database_names, *_ = result.fetchone()
|
275
|
-
database_names: list[str] = database_names.split(',')
|
276
|
-
schema_dict = {}
|
277
|
-
for database, table, column in result:
|
278
|
-
if database in database_names:
|
279
|
-
database_names.remove(database)
|
280
|
-
|
281
|
-
## Index database.
|
282
|
-
if database not in schema_dict:
|
283
|
-
schema_dict[database] = {table: [column]}
|
284
|
-
continue
|
285
|
-
table_dict: dict = schema_dict[database]
|
286
|
-
|
287
|
-
## Index table.
|
288
|
-
if table not in table_dict:
|
289
|
-
table_dict[table] = [column]
|
290
|
-
continue
|
291
|
-
column_list: list = table_dict[table]
|
292
|
-
|
293
|
-
## Add column.
|
294
|
-
column_list.append(column)
|
295
|
-
|
296
|
-
## Add empty database.
|
297
|
-
for name in database_names:
|
298
|
-
schema_dict[name] = None
|
299
|
-
|
300
|
-
return schema_dict
|
301
|
-
|
302
|
-
|
303
241
|
def connect(self, autocommit: bool = False) -> rbase.DatabaseConnectionT:
|
304
242
|
"""
|
305
243
|
Build database connection instance.
|
@@ -341,7 +279,7 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
341
279
|
|
342
280
|
|
343
281
|
@property
|
344
|
-
def orm(self):
|
282
|
+
def orm(self) -> 'rbase.DatabaseORMT':
|
345
283
|
"""
|
346
284
|
Build database ORM instance.
|
347
285
|
|
@@ -351,51 +289,51 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
351
289
|
"""
|
352
290
|
|
353
291
|
# Build.
|
354
|
-
|
292
|
+
match self:
|
293
|
+
case Database():
|
294
|
+
orm = rorm.DatabaseORM(self)
|
295
|
+
case DatabaseAsync():
|
296
|
+
orm = rorm.DatabaseORMAsync(self)
|
355
297
|
|
356
298
|
return orm
|
357
299
|
|
358
300
|
|
359
301
|
@property
|
360
|
-
def
|
302
|
+
def build(self):
|
361
303
|
"""
|
362
|
-
Build database
|
304
|
+
Build database build instance.
|
363
305
|
|
364
306
|
Returns
|
365
307
|
-------
|
366
308
|
Instance.
|
309
|
+
"""
|
367
310
|
|
368
|
-
|
369
|
-
|
370
|
-
Get databases information of server.
|
371
|
-
>>> databases_info = DatabaseInformationSchema()
|
311
|
+
# Build.
|
312
|
+
dbbuild = rbuild.DatabaseBuild(self)
|
372
313
|
|
373
|
-
|
374
|
-
>>> tables_info = DatabaseInformationSchema.database()
|
314
|
+
return dbbuild
|
375
315
|
|
376
|
-
Get columns information of table.
|
377
|
-
>>> columns_info = DatabaseInformationSchema.database.table()
|
378
316
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
>>> database_attr = DatabaseInformationSchema.database.table['attribute']
|
317
|
+
@property
|
318
|
+
def file(self):
|
319
|
+
"""
|
320
|
+
Build database file instance.
|
384
321
|
|
385
|
-
|
386
|
-
|
322
|
+
Returns
|
323
|
+
-------
|
324
|
+
Instance.
|
387
325
|
"""
|
388
326
|
|
389
327
|
# Build.
|
390
|
-
|
328
|
+
dbfile = rfile.DatabaseFile(self)
|
391
329
|
|
392
|
-
return
|
330
|
+
return dbfile
|
393
331
|
|
394
332
|
|
395
333
|
@property
|
396
|
-
def
|
334
|
+
def error(self):
|
397
335
|
"""
|
398
|
-
Build database
|
336
|
+
Build database error instance.
|
399
337
|
|
400
338
|
Returns
|
401
339
|
-------
|
@@ -403,15 +341,15 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
403
341
|
"""
|
404
342
|
|
405
343
|
# Build.
|
406
|
-
|
344
|
+
dbfile = rerror.DatabaseError(self)
|
407
345
|
|
408
|
-
return
|
346
|
+
return dbfile
|
409
347
|
|
410
348
|
|
411
349
|
@property
|
412
|
-
def
|
350
|
+
def config(self):
|
413
351
|
"""
|
414
|
-
Build database
|
352
|
+
Build database config instance.
|
415
353
|
|
416
354
|
Returns
|
417
355
|
-------
|
@@ -419,31 +357,51 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
419
357
|
"""
|
420
358
|
|
421
359
|
# Build.
|
422
|
-
|
360
|
+
dbconfig = rconfig.DatabaseConfig(self)
|
423
361
|
|
424
|
-
return
|
362
|
+
return dbconfig
|
425
363
|
|
426
364
|
|
427
365
|
@property
|
428
|
-
def
|
366
|
+
def info(self):
|
429
367
|
"""
|
430
|
-
Build database
|
368
|
+
Build database information schema instance.
|
431
369
|
|
432
370
|
Returns
|
433
371
|
-------
|
434
372
|
Instance.
|
373
|
+
|
374
|
+
Examples
|
375
|
+
--------
|
376
|
+
Get databases information of server.
|
377
|
+
>>> databases_info = DatabaseInformationSchema()
|
378
|
+
|
379
|
+
Get tables information of database.
|
380
|
+
>>> tables_info = DatabaseInformationSchema.database()
|
381
|
+
|
382
|
+
Get columns information of table.
|
383
|
+
>>> columns_info = DatabaseInformationSchema.database.table()
|
384
|
+
|
385
|
+
Get database attribute.
|
386
|
+
>>> database_attr = DatabaseInformationSchema.database['attribute']
|
387
|
+
|
388
|
+
Get table attribute.
|
389
|
+
>>> database_attr = DatabaseInformationSchema.database.table['attribute']
|
390
|
+
|
391
|
+
Get column attribute.
|
392
|
+
>>> database_attr = DatabaseInformationSchema.database.table.column['attribute']
|
435
393
|
"""
|
436
394
|
|
437
395
|
# Build.
|
438
|
-
|
396
|
+
dbischema = rinfo.DatabaseInformationSchema(self)
|
439
397
|
|
440
|
-
return
|
398
|
+
return dbischema
|
441
399
|
|
442
400
|
|
443
401
|
@property
|
444
|
-
def
|
402
|
+
def schema(self) -> rbase.DatabaseSchemaT:
|
445
403
|
"""
|
446
|
-
Build database
|
404
|
+
Build database schema instance.
|
447
405
|
|
448
406
|
Returns
|
449
407
|
-------
|
@@ -451,9 +409,13 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
451
409
|
"""
|
452
410
|
|
453
411
|
# Build.
|
454
|
-
|
412
|
+
match self:
|
413
|
+
case Database():
|
414
|
+
schema = rparam.DatabaseSchema(self)
|
415
|
+
case DatabaseAsync():
|
416
|
+
schema = rparam.DatabaseSchemaAsync(self)
|
455
417
|
|
456
|
-
return
|
418
|
+
return schema
|
457
419
|
|
458
420
|
|
459
421
|
@property
|
@@ -473,7 +435,7 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
473
435
|
|
474
436
|
|
475
437
|
@property
|
476
|
-
def
|
438
|
+
def status_global(self):
|
477
439
|
"""
|
478
440
|
Build global database parameters status instance.
|
479
441
|
|
@@ -505,7 +467,7 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
505
467
|
|
506
468
|
|
507
469
|
@property
|
508
|
-
def
|
470
|
+
def variables_global(self):
|
509
471
|
"""
|
510
472
|
Build global database parameters variable instance.
|
511
473
|
|
@@ -522,13 +484,29 @@ class DatabaseSuper(rbase.DatabaseBase, Generic[rbase.EngineT, rbase.DatabaseCon
|
|
522
484
|
return dbpv
|
523
485
|
|
524
486
|
|
525
|
-
class Database(
|
487
|
+
class Database(
|
488
|
+
DatabaseSuper[
|
489
|
+
Engine,
|
490
|
+
'rconn.DatabaseConnection',
|
491
|
+
'rexec.DatabaseExecute',
|
492
|
+
'rparam.DatabaseSchema',
|
493
|
+
'rorm.DatabaseORM'
|
494
|
+
]
|
495
|
+
):
|
526
496
|
"""
|
527
497
|
Database type, based `MySQL`.
|
528
498
|
"""
|
529
499
|
|
530
500
|
|
531
|
-
class DatabaseAsync(
|
501
|
+
class DatabaseAsync(
|
502
|
+
DatabaseSuper[
|
503
|
+
AsyncEngine,
|
504
|
+
'rconn.DatabaseConnectionAsync',
|
505
|
+
'rexec.DatabaseExecuteAsync',
|
506
|
+
'rparam.DatabaseSchemaAsync',
|
507
|
+
'rorm.DatabaseORMAsync'
|
508
|
+
]
|
509
|
+
):
|
532
510
|
"""
|
533
511
|
Asynchronous database type, based `MySQL`.
|
534
512
|
"""
|
reydb/rerror.py
CHANGED
reydb/rexec.py
CHANGED
@@ -83,7 +83,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
83
83
|
|
84
84
|
Returns
|
85
85
|
-------
|
86
|
-
|
86
|
+
Parameter `sql` and `data` and `report`.
|
87
87
|
"""
|
88
88
|
|
89
89
|
# Handle parameter.
|
@@ -136,7 +136,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
136
136
|
|
137
137
|
Returns
|
138
138
|
-------
|
139
|
-
|
139
|
+
Parameter `sql`.
|
140
140
|
"""
|
141
141
|
|
142
142
|
# Generate SQL.
|
@@ -226,7 +226,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
226
226
|
|
227
227
|
Returns
|
228
228
|
-------
|
229
|
-
|
229
|
+
Parameter `sql` and `kwdata`.
|
230
230
|
"""
|
231
231
|
|
232
232
|
# Handle parameter.
|
@@ -363,7 +363,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
363
363
|
|
364
364
|
Returns
|
365
365
|
-------
|
366
|
-
|
366
|
+
Parameter `sql` and `data`.
|
367
367
|
"""
|
368
368
|
|
369
369
|
# Handle parameter.
|
@@ -547,7 +547,7 @@ class DatabaseExecuteSuper(DatabaseBase, Generic[DatabaseConnectionT]):
|
|
547
547
|
|
548
548
|
Returns
|
549
549
|
-------
|
550
|
-
|
550
|
+
Parameter `sql`.
|
551
551
|
"""
|
552
552
|
|
553
553
|
# Handle parameter.
|
reydb/rfile.py
CHANGED
reydb/rinfo.py
CHANGED
@@ -197,7 +197,7 @@ class DatabaseInformationSchema(DatabaseInformation):
|
|
197
197
|
|
198
198
|
Parameters
|
199
199
|
----------
|
200
|
-
db:
|
200
|
+
db: Database instance.
|
201
201
|
"""
|
202
202
|
|
203
203
|
# Set parameter.
|
@@ -261,7 +261,7 @@ class DatabaseInformationDatabase(DatabaseInformation):
|
|
261
261
|
|
262
262
|
Parameters
|
263
263
|
----------
|
264
|
-
db:
|
264
|
+
db: Database instance.
|
265
265
|
database : Database name.
|
266
266
|
"""
|
267
267
|
|
@@ -357,7 +357,7 @@ class DatabaseInformationTable(DatabaseInformation):
|
|
357
357
|
|
358
358
|
Parameters
|
359
359
|
----------
|
360
|
-
db:
|
360
|
+
db: Database instance.
|
361
361
|
database : Database name.
|
362
362
|
table : Table name.
|
363
363
|
"""
|
@@ -452,7 +452,7 @@ class DatabaseInformationColumn(DatabaseInformation):
|
|
452
452
|
|
453
453
|
Parameters
|
454
454
|
----------
|
455
|
-
db:
|
455
|
+
db: Database instance.
|
456
456
|
database : Database name.
|
457
457
|
table : Table name.
|
458
458
|
column : Column name.
|