reydb 1.1.51__py3-none-any.whl → 1.1.52__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/rconn.py +1 -1
- reydb/rdb.py +1 -1
- reydb/rexec.py +57 -1
- reydb/rinfo.py +10 -11
- reydb/rorm.py +243 -25
- {reydb-1.1.51.dist-info → reydb-1.1.52.dist-info}/METADATA +1 -1
- {reydb-1.1.51.dist-info → reydb-1.1.52.dist-info}/RECORD +9 -9
- {reydb-1.1.51.dist-info → reydb-1.1.52.dist-info}/WHEEL +0 -0
- {reydb-1.1.51.dist-info → reydb-1.1.52.dist-info}/licenses/LICENSE +0 -0
reydb/rconn.py
CHANGED
reydb/rdb.py
CHANGED
reydb/rexec.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from typing import Any, Literal
|
12
|
+
from typing import Any, Literal, overload
|
13
13
|
from collections.abc import Iterable, Generator, Container
|
14
14
|
from enum import EnumType
|
15
15
|
from sqlalchemy import text as sqlalchemy_text
|
@@ -17,6 +17,7 @@ from sqlalchemy.sql.elements import TextClause
|
|
17
17
|
from reykit.rbase import throw, get_first_notnone
|
18
18
|
from reykit.rdata import FunctionGenerator, to_json
|
19
19
|
from reykit.rmonkey import monkey_sqlalchemy_result_more_fetch, monkey_sqlalchemy_row_index_field
|
20
|
+
from reykit.rrand import randn
|
20
21
|
from reykit.rre import findall
|
21
22
|
from reykit.rstdout import echo
|
22
23
|
from reykit.rtable import TableData, Table
|
@@ -891,6 +892,61 @@ class DatabaseExecute(DatabaseBase):
|
|
891
892
|
return func_generator.generator
|
892
893
|
|
893
894
|
|
895
|
+
@overload
|
896
|
+
def sleep(self, report: bool | None = None) -> int: ...
|
897
|
+
|
898
|
+
@overload
|
899
|
+
def sleep(self, second: int, report: bool | None = None) -> int: ...
|
900
|
+
|
901
|
+
@overload
|
902
|
+
def sleep(self, low: int = 0, high: int = 10, report: bool | None = None) -> int: ...
|
903
|
+
|
904
|
+
@overload
|
905
|
+
def sleep(self, *thresholds: float, report: bool | None = None) -> float: ...
|
906
|
+
|
907
|
+
@overload
|
908
|
+
def sleep(self, *thresholds: float, precision: Literal[0], report: bool | None = None) -> int: ...
|
909
|
+
|
910
|
+
@overload
|
911
|
+
def sleep(self, *thresholds: float, precision: int, report: bool | None = None) -> float: ...
|
912
|
+
|
913
|
+
def sleep(self, *thresholds: float, precision: int | None = None, report: bool | None = None) -> float:
|
914
|
+
"""
|
915
|
+
Let the database wait random seconds.
|
916
|
+
|
917
|
+
Parameters
|
918
|
+
----------
|
919
|
+
thresholds : Low and high thresholds of random range, range contains thresholds.
|
920
|
+
- When `length is 0`, then low and high thresholds is `0` and `10`.
|
921
|
+
- When `length is 1`, then low and high thresholds is `0` and `thresholds[0]`.
|
922
|
+
- When `length is 2`, then low and high thresholds is `thresholds[0]` and `thresholds[1]`.
|
923
|
+
precision : Precision of random range, that is maximum decimal digits of return value.
|
924
|
+
- `None`: Set to Maximum decimal digits of element of parameter `thresholds`.
|
925
|
+
- `int`: Set to this value.
|
926
|
+
report : Whether report SQL execute information.
|
927
|
+
- `None`: Use attribute `default_report`.
|
928
|
+
- `bool`: Use this value.
|
929
|
+
|
930
|
+
Returns
|
931
|
+
-------
|
932
|
+
Random seconds.
|
933
|
+
- When parameters `precision` is `0`, then return int.
|
934
|
+
- When parameters `precision` is `greater than 0`, then return float.
|
935
|
+
"""
|
936
|
+
|
937
|
+
# Handle parameter.
|
938
|
+
if len(thresholds) == 1:
|
939
|
+
second = thresholds[0]
|
940
|
+
else:
|
941
|
+
second = randn(*thresholds, precision=precision)
|
942
|
+
|
943
|
+
# Sleep.
|
944
|
+
sql = f'SELECT SLEEP({second})'
|
945
|
+
self.execute(sql, report=report)
|
946
|
+
|
947
|
+
return second
|
948
|
+
|
949
|
+
|
894
950
|
def handle_sql(self, sql: str | TextClause) -> TextClause:
|
895
951
|
"""
|
896
952
|
Handle SQL.
|
reydb/rinfo.py
CHANGED
@@ -9,7 +9,6 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from __future__ import annotations
|
13
12
|
from typing import Any, Literal, overload
|
14
13
|
|
15
14
|
from .rbase import DatabaseBase
|
@@ -32,21 +31,21 @@ class DatabaseInformation(DatabaseBase):
|
|
32
31
|
|
33
32
|
|
34
33
|
@overload
|
35
|
-
def __call__(self: DatabaseInformationSchema | DatabaseInformationSchema | DatabaseInformationDatabase | DatabaseInformationTable) -> list[dict]: ...
|
34
|
+
def __call__(self: 'DatabaseInformationSchema | DatabaseInformationSchema | DatabaseInformationDatabase | DatabaseInformationTable') -> list[dict]: ...
|
36
35
|
|
37
36
|
@overload
|
38
|
-
def __call__(self: DatabaseInformationSchema, name: str) -> DatabaseInformationDatabase: ...
|
37
|
+
def __call__(self: 'DatabaseInformationSchema', name: str) -> 'DatabaseInformationDatabase': ...
|
39
38
|
|
40
39
|
@overload
|
41
|
-
def __call__(self: DatabaseInformationDatabase, name: str) -> DatabaseInformationTable: ...
|
40
|
+
def __call__(self: 'DatabaseInformationDatabase', name: str) -> 'DatabaseInformationTable': ...
|
42
41
|
|
43
42
|
@overload
|
44
|
-
def __call__(self: DatabaseInformationTable, name: str) -> DatabaseInformationColumn: ...
|
43
|
+
def __call__(self: 'DatabaseInformationTable', name: str) -> 'DatabaseInformationColumn': ...
|
45
44
|
|
46
45
|
@overload
|
47
|
-
def __call__(self: DatabaseInformationColumn) -> dict: ...
|
46
|
+
def __call__(self: 'DatabaseInformationColumn') -> dict: ...
|
48
47
|
|
49
|
-
def __call__(self, name: str | None = None) -> DatabaseInformationDatabase | DatabaseInformationTable | DatabaseInformationColumn | list[dict] | dict:
|
48
|
+
def __call__(self, name: str | None = None) -> 'DatabaseInformationDatabase | DatabaseInformationTable | DatabaseInformationColumn | list[dict] | dict':
|
50
49
|
"""
|
51
50
|
Get information table or subclass instance.
|
52
51
|
|
@@ -125,15 +124,15 @@ class DatabaseInformation(DatabaseBase):
|
|
125
124
|
|
126
125
|
|
127
126
|
@overload
|
128
|
-
def __getattr__(self: DatabaseInformationSchema, name: str) -> DatabaseInformationDatabase: ...
|
127
|
+
def __getattr__(self: 'DatabaseInformationSchema', name: str) -> 'DatabaseInformationDatabase': ...
|
129
128
|
|
130
129
|
@overload
|
131
|
-
def __getattr__(self: DatabaseInformationDatabase, name: str) -> DatabaseInformationTable: ...
|
130
|
+
def __getattr__(self: 'DatabaseInformationDatabase', name: str) -> 'DatabaseInformationTable': ...
|
132
131
|
|
133
132
|
@overload
|
134
|
-
def __getattr__(self: DatabaseInformationTable, name: str) -> DatabaseInformationColumn: ...
|
133
|
+
def __getattr__(self: 'DatabaseInformationTable', name: str) -> 'DatabaseInformationColumn': ...
|
135
134
|
|
136
|
-
def __getattr__(self, name: str) -> DatabaseInformationDatabase | DatabaseInformationTable | DatabaseInformationColumn:
|
135
|
+
def __getattr__(self, name: str) -> 'DatabaseInformationDatabase | DatabaseInformationTable | DatabaseInformationColumn':
|
137
136
|
"""
|
138
137
|
Build subclass instance.
|
139
138
|
|
reydb/rorm.py
CHANGED
@@ -11,9 +11,10 @@
|
|
11
11
|
|
12
12
|
from typing import Self, Any, Type, TypeVar, Generic, Final
|
13
13
|
from functools import wraps as functools_wraps
|
14
|
+
from pydantic import ConfigDict, field_validator as pydantic_field_validator, model_validator as pydantic_model_validator
|
14
15
|
from sqlalchemy.orm import SessionTransaction
|
15
16
|
from sqlalchemy.sql.dml import Insert, Update, Delete
|
16
|
-
from sqlmodel import SQLModel, Session, Field as sqlmodel_Field
|
17
|
+
from sqlmodel import SQLModel, Session, Table, Field as sqlmodel_Field
|
17
18
|
from sqlmodel.sql._expression_select_cls import SelectOfScalar as Select
|
18
19
|
from reykit.rbase import CallableT, is_instance
|
19
20
|
|
@@ -40,12 +41,42 @@ class DatabaseORMBase(DatabaseBase):
|
|
40
41
|
"""
|
41
42
|
|
42
43
|
|
44
|
+
class DatabaseORMModelField(DatabaseBase):
|
45
|
+
"""
|
46
|
+
Database ORM model filed type.
|
47
|
+
"""
|
48
|
+
|
49
|
+
|
43
50
|
class DatabaseORMModel(DatabaseORMBase, SQLModel):
|
44
51
|
"""
|
45
52
|
Database ORM model type.
|
46
53
|
"""
|
47
54
|
|
48
55
|
|
56
|
+
def update(self, data: 'DatabaseORMModel | dict[dict, Any]') -> None:
|
57
|
+
"""
|
58
|
+
Update attributes.
|
59
|
+
|
60
|
+
Parameters
|
61
|
+
----------
|
62
|
+
data : `DatabaseORMModel` or `dict`.
|
63
|
+
"""
|
64
|
+
|
65
|
+
# Update.
|
66
|
+
self.sqlmodel_update(data)
|
67
|
+
|
68
|
+
|
69
|
+
def validate(self) -> Self:
|
70
|
+
"""
|
71
|
+
Validate all attributes, and copy self instance to new instance.
|
72
|
+
"""
|
73
|
+
|
74
|
+
# Validate.
|
75
|
+
model = self.model_validate(self)
|
76
|
+
|
77
|
+
return model
|
78
|
+
|
79
|
+
|
49
80
|
def copy(self) -> Self:
|
50
81
|
"""
|
51
82
|
Copy self instance to new instance.
|
@@ -56,12 +87,76 @@ class DatabaseORMModel(DatabaseORMBase, SQLModel):
|
|
56
87
|
"""
|
57
88
|
|
58
89
|
# Copy.
|
59
|
-
data = self.
|
90
|
+
data = self.data
|
60
91
|
instance = self.__class__(**data)
|
61
92
|
|
62
93
|
return instance
|
63
94
|
|
64
95
|
|
96
|
+
@property
|
97
|
+
def data(self) -> dict[str, Any]:
|
98
|
+
"""
|
99
|
+
All attributes data.
|
100
|
+
|
101
|
+
Returns
|
102
|
+
-------
|
103
|
+
data.
|
104
|
+
"""
|
105
|
+
|
106
|
+
# Get.
|
107
|
+
data = self.model_dump()
|
108
|
+
|
109
|
+
return data
|
110
|
+
|
111
|
+
|
112
|
+
@classmethod
|
113
|
+
def table(cls_or_self) -> Table:
|
114
|
+
"""
|
115
|
+
Mapping `Table` instance.
|
116
|
+
|
117
|
+
Returns
|
118
|
+
-------
|
119
|
+
Instance.
|
120
|
+
"""
|
121
|
+
|
122
|
+
# Get.
|
123
|
+
table: Table = cls_or_self.__table__
|
124
|
+
|
125
|
+
return table
|
126
|
+
|
127
|
+
|
128
|
+
@classmethod
|
129
|
+
def comment(cls_or_self) -> str | None:
|
130
|
+
"""
|
131
|
+
Table comment.
|
132
|
+
|
133
|
+
Returns
|
134
|
+
-------
|
135
|
+
Comment.
|
136
|
+
"""
|
137
|
+
|
138
|
+
# Get.
|
139
|
+
table = cls_or_self.table()
|
140
|
+
comment = table.comment
|
141
|
+
|
142
|
+
return comment
|
143
|
+
|
144
|
+
|
145
|
+
@classmethod
|
146
|
+
def set_comment(cls_or_self, comment: str) -> None:
|
147
|
+
"""
|
148
|
+
Set table comment.
|
149
|
+
|
150
|
+
Parameters
|
151
|
+
----------
|
152
|
+
comment : Comment.
|
153
|
+
"""
|
154
|
+
|
155
|
+
# Set.
|
156
|
+
table = cls_or_self.table()
|
157
|
+
table.comment = comment
|
158
|
+
|
159
|
+
|
65
160
|
ModelT = TypeVar('ModelT', bound=DatabaseORMModel)
|
66
161
|
|
67
162
|
|
@@ -77,6 +172,9 @@ class DatabaseORM(DatabaseORMBase):
|
|
77
172
|
|
78
173
|
Model = DatabaseORMModel
|
79
174
|
Field = sqlmodel_Field
|
175
|
+
Config = ConfigDict
|
176
|
+
wrap_validate_filed = pydantic_field_validator
|
177
|
+
wrap_validate_model = pydantic_model_validator
|
80
178
|
|
81
179
|
|
82
180
|
def __init__(self, db: Database) -> None:
|
@@ -90,27 +188,75 @@ class DatabaseORM(DatabaseORMBase):
|
|
90
188
|
|
91
189
|
# Build.
|
92
190
|
self.db = db
|
191
|
+
self._session = self.session(True)
|
192
|
+
|
193
|
+
## Method.
|
194
|
+
self.get = self._session.get
|
195
|
+
self.gets = self._session.gets
|
196
|
+
self.all = self._session.all
|
197
|
+
self.add = self._session.add
|
93
198
|
|
94
199
|
## Avoid descriptor error.
|
95
200
|
self.Field = sqlmodel_Field
|
96
201
|
|
97
202
|
|
98
|
-
def session(self):
|
203
|
+
def session(self, autocommit: bool = False):
|
99
204
|
"""
|
100
205
|
Build `DataBaseORMSession` instance.
|
101
206
|
|
207
|
+
Parameters
|
208
|
+
----------
|
209
|
+
autocommit: Whether automatic commit execute.
|
210
|
+
|
102
211
|
Returns
|
103
212
|
-------
|
104
213
|
Instance.
|
105
214
|
"""
|
106
215
|
|
107
216
|
# Build.
|
108
|
-
sess = DataBaseORMSession(self)
|
217
|
+
sess = DataBaseORMSession(self, autocommit)
|
109
218
|
|
110
219
|
return sess
|
111
220
|
|
112
221
|
|
113
|
-
|
222
|
+
def create(
|
223
|
+
self,
|
224
|
+
*models: Type[DatabaseORMModel] | DatabaseORMModel,
|
225
|
+
skip: bool = False
|
226
|
+
) -> None:
|
227
|
+
"""
|
228
|
+
Create table.
|
229
|
+
|
230
|
+
Parameters
|
231
|
+
----------
|
232
|
+
models : ORM model instances.
|
233
|
+
check : Skip existing table.
|
234
|
+
"""
|
235
|
+
|
236
|
+
# Create.
|
237
|
+
for model in models:
|
238
|
+
table = model.table()
|
239
|
+
table.create(self.db.engine, checkfirst=skip)
|
240
|
+
|
241
|
+
|
242
|
+
def drop(
|
243
|
+
self,
|
244
|
+
*models: Type[DatabaseORMModel] | DatabaseORMModel,
|
245
|
+
skip: bool = False
|
246
|
+
) -> None:
|
247
|
+
"""
|
248
|
+
Delete table.
|
249
|
+
|
250
|
+
Parameters
|
251
|
+
----------
|
252
|
+
models : ORM model instances.
|
253
|
+
check : Skip not exist table.
|
254
|
+
"""
|
255
|
+
|
256
|
+
# Create.
|
257
|
+
for model in models:
|
258
|
+
table = model.table()
|
259
|
+
table.drop(self.db.engine, checkfirst=skip)
|
114
260
|
|
115
261
|
|
116
262
|
class DataBaseORMSession(DatabaseORMBase):
|
@@ -119,18 +265,24 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
119
265
|
"""
|
120
266
|
|
121
267
|
|
122
|
-
def __init__(
|
268
|
+
def __init__(
|
269
|
+
self,
|
270
|
+
orm: 'DatabaseORM',
|
271
|
+
autocommit: bool = False
|
272
|
+
) -> None:
|
123
273
|
"""
|
124
274
|
Build instance attributes.
|
125
275
|
|
126
276
|
Parameters
|
127
277
|
----------
|
128
278
|
orm : `DatabaseORM` instance.
|
279
|
+
autocommit: Whether automatic commit execute.
|
129
280
|
"""
|
130
281
|
|
131
282
|
# Build.
|
132
283
|
self.orm = orm
|
133
|
-
self.
|
284
|
+
self.autocommit = autocommit
|
285
|
+
self.session: Session | None = None
|
134
286
|
self.begin: SessionTransaction | None = None
|
135
287
|
|
136
288
|
|
@@ -162,7 +314,9 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
162
314
|
"""
|
163
315
|
|
164
316
|
# Close.
|
165
|
-
self.session
|
317
|
+
if self.session is not None:
|
318
|
+
self.session.close()
|
319
|
+
self.session = None
|
166
320
|
|
167
321
|
|
168
322
|
def __enter__(self) -> Self:
|
@@ -202,9 +356,9 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
202
356
|
__del__ = close
|
203
357
|
|
204
358
|
|
205
|
-
def
|
359
|
+
def wrap_transact(method: CallableT) -> CallableT:
|
206
360
|
"""
|
207
|
-
Decorator,
|
361
|
+
Decorator, automated transaction.
|
208
362
|
|
209
363
|
Parameters
|
210
364
|
----------
|
@@ -218,25 +372,76 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
218
372
|
|
219
373
|
# Define.
|
220
374
|
@functools_wraps(method)
|
221
|
-
def wrap(self, *args, **kwargs):
|
375
|
+
def wrap(self: 'DataBaseORMSession', *args, **kwargs):
|
376
|
+
|
377
|
+
# Session.
|
378
|
+
if self.session is None:
|
379
|
+
self.session = Session(self.orm.db.engine)
|
222
380
|
|
223
|
-
#
|
381
|
+
# Begin.
|
224
382
|
if self.begin is None:
|
225
383
|
self.begin = self.session.begin()
|
226
384
|
|
227
385
|
# Execute.
|
228
386
|
result = method(self, *args, **kwargs)
|
229
387
|
|
388
|
+
# Autucommit.
|
389
|
+
if self.autocommit:
|
390
|
+
self.commit()
|
391
|
+
self.close()
|
392
|
+
|
230
393
|
return result
|
231
394
|
|
232
395
|
|
233
396
|
return wrap
|
234
397
|
|
235
398
|
|
236
|
-
@
|
399
|
+
@wrap_transact
|
400
|
+
def create(
|
401
|
+
self,
|
402
|
+
*models: Type[DatabaseORMModel] | DatabaseORMModel,
|
403
|
+
skip: bool = False
|
404
|
+
) -> None:
|
405
|
+
"""
|
406
|
+
Create table.
|
407
|
+
|
408
|
+
Parameters
|
409
|
+
----------
|
410
|
+
models : ORM model instances.
|
411
|
+
check : Skip existing table.
|
412
|
+
"""
|
413
|
+
|
414
|
+
# Create.
|
415
|
+
for model in models:
|
416
|
+
table = model.table()
|
417
|
+
table.create(self.session.connection(), checkfirst=skip)
|
418
|
+
|
419
|
+
|
420
|
+
@wrap_transact
|
421
|
+
def drop(
|
422
|
+
self,
|
423
|
+
*models: Type[DatabaseORMModel] | DatabaseORMModel,
|
424
|
+
skip: bool = False
|
425
|
+
) -> None:
|
426
|
+
"""
|
427
|
+
Delete table.
|
428
|
+
|
429
|
+
Parameters
|
430
|
+
----------
|
431
|
+
models : ORM model instances.
|
432
|
+
check : Skip not exist table.
|
433
|
+
"""
|
434
|
+
|
435
|
+
# Create.
|
436
|
+
for model in models:
|
437
|
+
table = model.table()
|
438
|
+
table.drop(self.session.connection(), checkfirst=skip)
|
439
|
+
|
440
|
+
|
441
|
+
@wrap_transact
|
237
442
|
def get(self, model: Type[ModelT] | ModelT, key: Any | tuple[Any]) -> ModelT | None:
|
238
443
|
"""
|
239
|
-
|
444
|
+
Select records by primary key.
|
240
445
|
|
241
446
|
Parameters
|
242
447
|
----------
|
@@ -257,10 +462,17 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
257
462
|
# Get.
|
258
463
|
result = self.session.get(model, key)
|
259
464
|
|
465
|
+
# Autucommit.
|
466
|
+
if (
|
467
|
+
self.autocommit
|
468
|
+
and result is not None
|
469
|
+
):
|
470
|
+
self.session.expunge(result)
|
471
|
+
|
260
472
|
return result
|
261
473
|
|
262
474
|
|
263
|
-
@
|
475
|
+
@wrap_transact
|
264
476
|
def gets(self, model: Type[ModelT] | ModelT, *keys: Any | tuple[Any]) -> list[ModelT]:
|
265
477
|
"""
|
266
478
|
Select records by primary key sequence.
|
@@ -291,7 +503,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
291
503
|
return results
|
292
504
|
|
293
505
|
|
294
|
-
@
|
506
|
+
@wrap_transact
|
295
507
|
def all(self, model: Type[ModelT] | ModelT) -> list[ModelT]:
|
296
508
|
"""
|
297
509
|
Select all records.
|
@@ -305,13 +517,19 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
305
517
|
With records ORM model instance list.
|
306
518
|
"""
|
307
519
|
|
520
|
+
# Handle parameter.
|
521
|
+
if is_instance(model):
|
522
|
+
model = type(model)
|
523
|
+
|
308
524
|
# Get.
|
309
|
-
|
525
|
+
select = Select(model)
|
526
|
+
models = self.session.exec(select)
|
527
|
+
models = list(models)
|
310
528
|
|
311
529
|
return models
|
312
530
|
|
313
531
|
|
314
|
-
@
|
532
|
+
@wrap_transact
|
315
533
|
def add(self, *models: DatabaseORMModel) -> None:
|
316
534
|
"""
|
317
535
|
Insert records.
|
@@ -325,7 +543,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
325
543
|
self.session.add_all(models)
|
326
544
|
|
327
545
|
|
328
|
-
@
|
546
|
+
@wrap_transact
|
329
547
|
def rm(self, *models: DatabaseORMModel) -> None:
|
330
548
|
"""
|
331
549
|
Delete records.
|
@@ -340,7 +558,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
340
558
|
self.session.delete(model)
|
341
559
|
|
342
560
|
|
343
|
-
@
|
561
|
+
@wrap_transact
|
344
562
|
def refresh(self, *models: DatabaseORMModel) -> None:
|
345
563
|
"""
|
346
564
|
Refresh records.
|
@@ -355,7 +573,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
355
573
|
self.session.refresh(model)
|
356
574
|
|
357
575
|
|
358
|
-
@
|
576
|
+
@wrap_transact
|
359
577
|
def expire(self, *models: DatabaseORMModel) -> None:
|
360
578
|
"""
|
361
579
|
Mark records to expire, refresh on next call.
|
@@ -370,7 +588,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
370
588
|
self.session.expire(model)
|
371
589
|
|
372
590
|
|
373
|
-
@
|
591
|
+
@wrap_transact
|
374
592
|
def select(self, model: Type[ModelT] | ModelT):
|
375
593
|
"""
|
376
594
|
Build `DatabaseORMSelect` instance.
|
@@ -394,7 +612,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
394
612
|
return select
|
395
613
|
|
396
614
|
|
397
|
-
@
|
615
|
+
@wrap_transact
|
398
616
|
def insert(self, model: Type[ModelT] | ModelT):
|
399
617
|
"""
|
400
618
|
Build `DatabaseORMInsert` instance.
|
@@ -418,7 +636,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
418
636
|
return select
|
419
637
|
|
420
638
|
|
421
|
-
@
|
639
|
+
@wrap_transact
|
422
640
|
def update(self, model: Type[ModelT] | ModelT):
|
423
641
|
"""
|
424
642
|
Build `DatabaseORMUpdate` instance.
|
@@ -442,7 +660,7 @@ class DataBaseORMSession(DatabaseORMBase):
|
|
442
660
|
return select
|
443
661
|
|
444
662
|
|
445
|
-
@
|
663
|
+
@wrap_transact
|
446
664
|
def delete(self, model: Type[ModelT] | ModelT):
|
447
665
|
"""
|
448
666
|
Build `DatabaseORMDelete` instance.
|
@@ -3,15 +3,15 @@ reydb/rall.py,sha256=GsXHqvT1k--U53HpDY4SALjIHN8rwgSxeXpJjH5gq2E,409
|
|
3
3
|
reydb/rbase.py,sha256=A7or663TcrQyq56P813WsV4BlApZIzXOPdZLsT7KwWw,7040
|
4
4
|
reydb/rbuild.py,sha256=6N8aLqCeX8JnOwQstVA2AuM0Rl5kUHx5Enrm2GGcGvo,31852
|
5
5
|
reydb/rconfig.py,sha256=kkqJg68bGZTE3JqH9dF1n-c1shuPJ4O8Bqg7J9Pd2CM,12659
|
6
|
-
reydb/rconn.py,sha256=
|
7
|
-
reydb/rdb.py,sha256=
|
6
|
+
reydb/rconn.py,sha256=AYGi_A4qMMHEAiH0lGtHpH2Q3PZylNFoBjGtXeDSNlA,2810
|
7
|
+
reydb/rdb.py,sha256=ZtEb6LSL4yFw5pnolqL39fr7BgeGMMUk-OYotpx_Mrw,12916
|
8
8
|
reydb/rerror.py,sha256=Lsl7UECYdIFYjd9t7RhvNcHdyGStI3gffm8zmkK1DEc,9943
|
9
|
-
reydb/rexec.py,sha256=
|
9
|
+
reydb/rexec.py,sha256=z82pYvtFQmYaKWeo26G7jT2f3f9IyxCPfF4n5Cf0LcM,31222
|
10
10
|
reydb/rfile.py,sha256=8HSrlpuslSCcWzjeh2y4Fs7R_qnm3jS_c13CDrKxpaw,15182
|
11
|
-
reydb/rinfo.py,sha256=
|
12
|
-
reydb/rorm.py,sha256=
|
11
|
+
reydb/rinfo.py,sha256=4btKBBZzVXGuPsmswqXDxvjZQuAc9raQ0tpXvmft71s,12741
|
12
|
+
reydb/rorm.py,sha256=DvRBRPdvfq019CZV21OJoTdcqicDZUBdSMzlikTFLXg,16563
|
13
13
|
reydb/rparam.py,sha256=six7wwQRKycoscv-AGyQqsPjA4_TZgcGQ_jk7FZytQs,6803
|
14
|
-
reydb-1.1.
|
15
|
-
reydb-1.1.
|
16
|
-
reydb-1.1.
|
17
|
-
reydb-1.1.
|
14
|
+
reydb-1.1.52.dist-info/METADATA,sha256=bNFHLGFuX0lblm5mSXi_Es8l0nHOLdt12-fSh54BaNU,1550
|
15
|
+
reydb-1.1.52.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reydb-1.1.52.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reydb-1.1.52.dist-info/RECORD,,
|
File without changes
|
File without changes
|