amsdal 0.4.13__cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.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.
- amsdal/Third-Party Materials - AMSDAL Dependencies - License Notices.md +1334 -0
- amsdal/__about__.py +4 -0
- amsdal/__about__.pyi +1 -0
- amsdal/__init__.py +23 -0
- amsdal/__init__.pyi +9 -0
- amsdal/__migrations__/0000_initial.py +217 -0
- amsdal/__migrations__/0001_datetime_type.py +18 -0
- amsdal/__migrations__/0002_fixture_order.py +44 -0
- amsdal/__migrations__/0003_schema_type_in_class_meta.py +44 -0
- amsdal/cloud/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/__init__.pyi +0 -0
- amsdal/cloud/client.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/client.pyi +57 -0
- amsdal/cloud/constants.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/constants.pyi +13 -0
- amsdal/cloud/enums.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/enums.pyi +68 -0
- amsdal/cloud/models/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/__init__.pyi +0 -0
- amsdal/cloud/models/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/models/base.pyi +247 -0
- amsdal/cloud/services/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/__init__.pyi +0 -0
- amsdal/cloud/services/actions/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/__init__.pyi +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/add_basic_auth.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_basic_auth.pyi +21 -0
- amsdal/cloud/services/actions/add_dependency.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_dependency.pyi +19 -0
- amsdal/cloud/services/actions/add_secret.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/add_secret.pyi +20 -0
- amsdal/cloud/services/actions/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/base.pyi +122 -0
- amsdal/cloud/services/actions/create_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_deploy.pyi +41 -0
- amsdal/cloud/services/actions/create_env.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_env.pyi +19 -0
- amsdal/cloud/services/actions/create_session.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/create_session.pyi +17 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_allowlist_ip.pyi +19 -0
- amsdal/cloud/services/actions/delete_basic_auth.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_basic_auth.pyi +20 -0
- amsdal/cloud/services/actions/delete_dependency.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_dependency.pyi +21 -0
- amsdal/cloud/services/actions/delete_env.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_env.pyi +21 -0
- amsdal/cloud/services/actions/delete_secret.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/delete_secret.pyi +21 -0
- amsdal/cloud/services/actions/destroy_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/destroy_deploy.pyi +18 -0
- amsdal/cloud/services/actions/expose_db.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/expose_db.pyi +22 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_basic_auth_credentials.pyi +21 -0
- amsdal/cloud/services/actions/get_monitoring_info.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/get_monitoring_info.pyi +21 -0
- amsdal/cloud/services/actions/list_dependencies.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_dependencies.pyi +21 -0
- amsdal/cloud/services/actions/list_deploys.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_deploys.pyi +19 -0
- amsdal/cloud/services/actions/list_envs.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_envs.pyi +20 -0
- amsdal/cloud/services/actions/list_secrets.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/list_secrets.pyi +22 -0
- amsdal/cloud/services/actions/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/manager.pyi +278 -0
- amsdal/cloud/services/actions/signup_action.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/signup_action.pyi +20 -0
- amsdal/cloud/services/actions/update_deploy.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/actions/update_deploy.pyi +19 -0
- amsdal/cloud/services/auth/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/__init__.pyi +0 -0
- amsdal/cloud/services/auth/base.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/base.pyi +6 -0
- amsdal/cloud/services/auth/credentials.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/credentials.pyi +30 -0
- amsdal/cloud/services/auth/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/manager.pyi +26 -0
- amsdal/cloud/services/auth/signup_service.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/signup_service.pyi +32 -0
- amsdal/cloud/services/auth/token.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/cloud/services/auth/token.pyi +27 -0
- amsdal/configs/__init__.py +0 -0
- amsdal/configs/__init__.pyi +0 -0
- amsdal/configs/constants.py +33 -0
- amsdal/configs/constants.pyi +22 -0
- amsdal/configs/main.py +258 -0
- amsdal/configs/main.pyi +173 -0
- amsdal/context/__init__.py +0 -0
- amsdal/context/__init__.pyi +0 -0
- amsdal/context/manager.py +69 -0
- amsdal/context/manager.pyi +50 -0
- amsdal/contrib/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/contrib/__init__.pyi +0 -0
- amsdal/contrib/app_config.py +7 -0
- amsdal/contrib/app_config.pyi +6 -0
- amsdal/contrib/auth/__init__.py +0 -0
- amsdal/contrib/auth/__init__.pyi +0 -0
- amsdal/contrib/auth/app.py +27 -0
- amsdal/contrib/auth/app.pyi +15 -0
- amsdal/contrib/auth/decorators/__init__.py +35 -0
- amsdal/contrib/auth/decorators/__init__.pyi +6 -0
- amsdal/contrib/auth/errors.py +7 -0
- amsdal/contrib/auth/errors.pyi +4 -0
- amsdal/contrib/auth/fixtures/basic_permissions.json +64 -0
- amsdal/contrib/auth/lifecycle/__init__.py +0 -0
- amsdal/contrib/auth/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/auth/lifecycle/consumer.py +394 -0
- amsdal/contrib/auth/lifecycle/consumer.pyi +108 -0
- amsdal/contrib/auth/migrations/0000_initial.py +84 -0
- amsdal/contrib/auth/models/__init__.py +0 -0
- amsdal/contrib/auth/models/__init__.pyi +0 -0
- amsdal/contrib/auth/models/login_session.py +118 -0
- amsdal/contrib/auth/models/login_session.pyi +37 -0
- amsdal/contrib/auth/models/permission.py +23 -0
- amsdal/contrib/auth/models/permission.pyi +18 -0
- amsdal/contrib/auth/models/user.py +106 -0
- amsdal/contrib/auth/models/user.pyi +46 -0
- amsdal/contrib/auth/settings.py +36 -0
- amsdal/contrib/auth/settings.pyi +26 -0
- amsdal/contrib/frontend_configs/__init__.py +0 -0
- amsdal/contrib/frontend_configs/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/app.py +24 -0
- amsdal/contrib/frontend_configs/app.pyi +19 -0
- amsdal/contrib/frontend_configs/constants.py +1 -0
- amsdal/contrib/frontend_configs/constants.pyi +1 -0
- amsdal/contrib/frontend_configs/conversion/__init__.py +5 -0
- amsdal/contrib/frontend_configs/conversion/__init__.pyi +3 -0
- amsdal/contrib/frontend_configs/conversion/convert.py +286 -0
- amsdal/contrib/frontend_configs/conversion/convert.pyi +22 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.py +0 -0
- amsdal/contrib/frontend_configs/lifecycle/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.py +306 -0
- amsdal/contrib/frontend_configs/lifecycle/consumer.pyi +98 -0
- amsdal/contrib/frontend_configs/migrations/0000_initial.py +256 -0
- amsdal/contrib/frontend_configs/models/__init__.py +0 -0
- amsdal/contrib/frontend_configs/models/__init__.pyi +0 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.py +22 -0
- amsdal/contrib/frontend_configs/models/frontend_activator_config.pyi +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.py +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_async_validator.pyi +7 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.py +54 -0
- amsdal/contrib/frontend_configs/models/frontend_config_control_action.pyi +32 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.py +21 -0
- amsdal/contrib/frontend_configs/models/frontend_config_group_validator.pyi +11 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.py +12 -0
- amsdal/contrib/frontend_configs/models/frontend_config_option.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.py +17 -0
- amsdal/contrib/frontend_configs/models/frontend_config_skip_none_base.pyi +8 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.py +13 -0
- amsdal/contrib/frontend_configs/models/frontend_config_slider_option.pyi +9 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_config_text_mask.pyi +10 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.py +28 -0
- amsdal/contrib/frontend_configs/models/frontend_config_validator.pyi +15 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.py +87 -0
- amsdal/contrib/frontend_configs/models/frontend_control_config.pyi +35 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.py +14 -0
- amsdal/contrib/frontend_configs/models/frontend_model_config.pyi +9 -0
- amsdal/contrib/frontend_configs/utils.py +29 -0
- amsdal/contrib/frontend_configs/utils.pyi +17 -0
- amsdal/errors.py +31 -0
- amsdal/errors.pyi +12 -0
- amsdal/fixtures/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/__init__.pyi +0 -0
- amsdal/fixtures/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/manager.pyi +170 -0
- amsdal/fixtures/utils.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/fixtures/utils.pyi +9 -0
- amsdal/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/manager.pyi +265 -0
- amsdal/mixins/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/__init__.pyi +0 -0
- amsdal/mixins/class_versions_mixin.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/mixins/class_versions_mixin.pyi +12 -0
- amsdal/models/__init__.py +19 -0
- amsdal/models/__init__.pyi +9 -0
- amsdal/models/core/__init__.py +0 -0
- amsdal/models/core/__init__.pyi +0 -0
- amsdal/models/core/class_object.py +37 -0
- amsdal/models/core/class_object.pyi +24 -0
- amsdal/models/core/class_object_meta.py +26 -0
- amsdal/models/core/class_object_meta.pyi +15 -0
- amsdal/models/core/class_property.py +20 -0
- amsdal/models/core/class_property.pyi +11 -0
- amsdal/models/core/class_property_meta.py +15 -0
- amsdal/models/core/class_property_meta.pyi +10 -0
- amsdal/models/core/file.py +156 -0
- amsdal/models/core/file.pyi +104 -0
- amsdal/models/core/fixture.py +25 -0
- amsdal/models/core/fixture.pyi +14 -0
- amsdal/models/core/option.py +11 -0
- amsdal/models/core/option.pyi +8 -0
- amsdal/models/core/validator.py +12 -0
- amsdal/models/core/validator.pyi +8 -0
- amsdal/models/types/__init__.py +0 -0
- amsdal/models/types/__init__.pyi +0 -0
- amsdal/models/types/object.py +26 -0
- amsdal/models/types/object.pyi +16 -0
- amsdal/py.typed +0 -0
- amsdal/queryset/__init__.py +21 -0
- amsdal/queryset/__init__.pyi +6 -0
- amsdal/schemas/__init__.py +0 -0
- amsdal/schemas/__init__.pyi +0 -0
- amsdal/schemas/core/class_object/model.json +31 -0
- amsdal/schemas/core/class_object/properties/display_name.py +9 -0
- amsdal/schemas/core/class_object_meta/model.json +59 -0
- amsdal/schemas/core/class_property/model.json +22 -0
- amsdal/schemas/core/class_property_meta/model.json +23 -0
- amsdal/schemas/core/file/hooks/pre_create.py +24 -0
- amsdal/schemas/core/file/hooks/pre_update.py +24 -0
- amsdal/schemas/core/file/model.json +23 -0
- amsdal/schemas/core/file/properties/from_file.py +34 -0
- amsdal/schemas/core/file/properties/mimetype.py +13 -0
- amsdal/schemas/core/file/properties/str.py +6 -0
- amsdal/schemas/core/file/properties/to_file.py +24 -0
- amsdal/schemas/core/file/properties/validate_data.py +32 -0
- amsdal/schemas/core/fixture/model.json +35 -0
- amsdal/schemas/core/option/model.json +19 -0
- amsdal/schemas/core/validator/model.json +19 -0
- amsdal/schemas/interfaces.py +25 -0
- amsdal/schemas/interfaces.pyi +20 -0
- amsdal/schemas/manager.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/schemas/manager.py +0 -0
- amsdal/schemas/manager.pyi +0 -0
- amsdal/schemas/mixins/__init__.py +0 -0
- amsdal/schemas/mixins/__init__.pyi +0 -0
- amsdal/schemas/mixins/check_dependencies_mixin.py +125 -0
- amsdal/schemas/mixins/check_dependencies_mixin.pyi +45 -0
- amsdal/schemas/mixins/verify_schemas_mixin.py +96 -0
- amsdal/schemas/mixins/verify_schemas_mixin.pyi +33 -0
- amsdal/schemas/repository.py +84 -0
- amsdal/schemas/repository.pyi +22 -0
- amsdal/schemas/types/anything/model.json +7 -0
- amsdal/schemas/types/array/model.json +7 -0
- amsdal/schemas/types/binary/model.json +7 -0
- amsdal/schemas/types/boolean/model.json +17 -0
- amsdal/schemas/types/date/model.json +7 -0
- amsdal/schemas/types/datetime/model.json +7 -0
- amsdal/schemas/types/dictionary/model.json +8 -0
- amsdal/schemas/types/number/model.json +8 -0
- amsdal/schemas/types/object/model.json +53 -0
- amsdal/schemas/types/string/model.json +8 -0
- amsdal/schemas/utils.py +16 -0
- amsdal/schemas/utils.pyi +10 -0
- amsdal/services/__init__.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/services/__init__.pyi +0 -0
- amsdal/services/transaction_execution.cpython-312-x86_64-linux-gnu.so +0 -0
- amsdal/services/transaction_execution.pyi +93 -0
- amsdal/transactions/__init__.py +13 -0
- amsdal/transactions/__init__.pyi +4 -0
- amsdal/utils/__init__.py +0 -0
- amsdal/utils/__init__.pyi +0 -0
- amsdal/utils/contrib_paths.py +23 -0
- amsdal/utils/contrib_paths.pyi +14 -0
- amsdal/utils/rollback/__init__.py +440 -0
- amsdal/utils/rollback/__init__.pyi +38 -0
- amsdal/utils/tests/__init__.py +0 -0
- amsdal/utils/tests/enums.py +18 -0
- amsdal/utils/tests/factories.py +49 -0
- amsdal/utils/tests/helpers.py +499 -0
- amsdal-0.4.13.dist-info/METADATA +369 -0
- amsdal-0.4.13.dist-info/RECORD +269 -0
- amsdal-0.4.13.dist-info/WHEEL +6 -0
- amsdal-0.4.13.dist-info/licenses/LICENSE.txt +107 -0
- amsdal-0.4.13.dist-info/top_level.txt +1 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
import ast
|
2
|
+
from _typeshed import Incomplete
|
3
|
+
from amsdal.configs.main import settings as settings
|
4
|
+
from amsdal.errors import TransactionNotFoundError as TransactionNotFoundError
|
5
|
+
from amsdal_utils.utils.singleton import Singleton
|
6
|
+
from collections.abc import Callable as Callable, Generator
|
7
|
+
from pathlib import Path
|
8
|
+
from typing import Any
|
9
|
+
|
10
|
+
logger: Incomplete
|
11
|
+
|
12
|
+
def is_transaction(statement: ast.AST) -> bool:
|
13
|
+
"""
|
14
|
+
Determines if a given AST statement is a transaction function.
|
15
|
+
|
16
|
+
This function checks if the provided AST statement is an asynchronous or synchronous function
|
17
|
+
definition that is decorated with the `transaction` decorator.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
statement (ast.AST): The AST statement to check.
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
bool: True if the statement is a transaction function, False otherwise.
|
24
|
+
"""
|
25
|
+
def annotation_is_model(annotation: Any) -> bool: ...
|
26
|
+
|
27
|
+
class TransactionExecutionService(metaclass=Singleton):
|
28
|
+
"""
|
29
|
+
Service for executing transactions.
|
30
|
+
|
31
|
+
This class provides methods to execute transactions, load transaction functions,
|
32
|
+
and handle asynchronous transactions. It ensures that transactions are executed
|
33
|
+
with the correct arguments and handles any necessary preprocessing of arguments.
|
34
|
+
"""
|
35
|
+
_transactions: dict[str, Callable[..., Any]]
|
36
|
+
def __init__(self) -> None: ...
|
37
|
+
def execute_transaction(self, transaction_name: str, args: dict[str, Any], *, load_references: bool = True) -> Any:
|
38
|
+
"""
|
39
|
+
Executes a transaction with the given name and arguments.
|
40
|
+
|
41
|
+
This method retrieves the transaction function by its name, processes the arguments,
|
42
|
+
and executes the transaction. It handles both synchronous and asynchronous transactions
|
43
|
+
and performs necessary preprocessing of arguments, such as loading references.
|
44
|
+
|
45
|
+
Args:
|
46
|
+
transaction_name (str): The name of the transaction to execute.
|
47
|
+
args (dict[str, Any]): The arguments to pass to the transaction function.
|
48
|
+
load_references (bool, optional): Whether to load references in the arguments. Defaults to True.
|
49
|
+
|
50
|
+
Returns:
|
51
|
+
Any: The result of the transaction execution.
|
52
|
+
"""
|
53
|
+
async def async_execute_transaction(self, transaction_name: str, args: dict[str, Any], *, load_references: bool = True) -> Any:
|
54
|
+
"""
|
55
|
+
Executes a transaction with the given name and arguments.
|
56
|
+
|
57
|
+
This method retrieves the transaction function by its name, processes the arguments,
|
58
|
+
and executes the transaction. It handles both synchronous and asynchronous transactions
|
59
|
+
and performs necessary preprocessing of arguments, such as loading references.
|
60
|
+
|
61
|
+
Args:
|
62
|
+
transaction_name (str): The name of the transaction to execute.
|
63
|
+
args (dict[str, Any]): The arguments to pass to the transaction function.
|
64
|
+
load_references (bool, optional): Whether to load references in the arguments. Defaults to True.
|
65
|
+
|
66
|
+
Returns:
|
67
|
+
Any: The result of the transaction execution.
|
68
|
+
"""
|
69
|
+
def get_transaction_func(self, transaction_name: str) -> Callable[..., Any]:
|
70
|
+
"""
|
71
|
+
Retrieves the transaction function by its name.
|
72
|
+
|
73
|
+
This method checks if the transaction function is already loaded in the `_transactions` dictionary.
|
74
|
+
If not, it attempts to load the transaction function from the available transaction definitions.
|
75
|
+
|
76
|
+
Args:
|
77
|
+
transaction_name (str): The name of the transaction function to retrieve.
|
78
|
+
|
79
|
+
Returns:
|
80
|
+
Callable[..., Any]: The transaction function corresponding to the given name.
|
81
|
+
|
82
|
+
Raises:
|
83
|
+
TransactionNotFoundError: If the transaction function with the specified name is not found.
|
84
|
+
"""
|
85
|
+
@staticmethod
|
86
|
+
def _run_async_transaction(transaction_func: Callable[..., Any], args: dict[str, Any]) -> Any: ...
|
87
|
+
def _load_transaction(self, transaction_name: str) -> Callable[..., Any]: ...
|
88
|
+
@classmethod
|
89
|
+
def _get_transaction_definitions(cls) -> Generator[tuple[ast.FunctionDef | ast.AsyncFunctionDef, Path], None, None]: ...
|
90
|
+
@classmethod
|
91
|
+
def _iterate_module(cls, module_path: Path) -> Generator[tuple[ast.FunctionDef | ast.AsyncFunctionDef, Path], None, None]: ...
|
92
|
+
@classmethod
|
93
|
+
def _iterate_file(cls, file_path: Path) -> Generator[tuple[ast.FunctionDef | ast.AsyncFunctionDef, Path], None, None]: ...
|
@@ -0,0 +1,13 @@
|
|
1
|
+
from amsdal_data.transactions import async_transaction
|
2
|
+
from amsdal_data.transactions import transaction
|
3
|
+
from amsdal_data.transactions.background.schedule import SCHEDULE_TYPE
|
4
|
+
from amsdal_data.transactions.background.schedule import Crontab
|
5
|
+
from amsdal_data.transactions.background.schedule import ScheduleConfig
|
6
|
+
|
7
|
+
__all__ = [
|
8
|
+
'SCHEDULE_TYPE',
|
9
|
+
'Crontab',
|
10
|
+
'ScheduleConfig',
|
11
|
+
'async_transaction',
|
12
|
+
'transaction',
|
13
|
+
]
|
@@ -0,0 +1,4 @@
|
|
1
|
+
from amsdal_data.transactions import async_transaction as async_transaction, transaction as transaction
|
2
|
+
from amsdal_data.transactions.background.schedule import Crontab as Crontab, SCHEDULE_TYPE as SCHEDULE_TYPE, ScheduleConfig as ScheduleConfig
|
3
|
+
|
4
|
+
__all__ = ['SCHEDULE_TYPE', 'Crontab', 'ScheduleConfig', 'async_transaction', 'transaction']
|
amsdal/utils/__init__.py
ADDED
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
from collections.abc import Generator
|
2
|
+
from importlib import import_module
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
|
6
|
+
def get_contrib_schemas_paths() -> Generator[Path, None, None]:
|
7
|
+
"""
|
8
|
+
Retrieves paths to contribution schemas.
|
9
|
+
|
10
|
+
This function iterates over the configured contributions in the settings and yields
|
11
|
+
the paths to the 'models' directories for each contribution.
|
12
|
+
|
13
|
+
Returns:
|
14
|
+
Generator[Path, None, None]: A generator that yields paths to the 'models' directories
|
15
|
+
of the configured contributions.
|
16
|
+
"""
|
17
|
+
from amsdal.configs.main import settings
|
18
|
+
|
19
|
+
for contrib in settings.CONTRIB:
|
20
|
+
module_name, *_ = contrib.rsplit('.', 2)
|
21
|
+
module = import_module(module_name)
|
22
|
+
|
23
|
+
yield Path(module.__file__).parent / 'models' # type: ignore[arg-type]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
from collections.abc import Generator
|
2
|
+
from pathlib import Path
|
3
|
+
|
4
|
+
def get_contrib_schemas_paths() -> Generator[Path, None, None]:
|
5
|
+
"""
|
6
|
+
Retrieves paths to contribution schemas.
|
7
|
+
|
8
|
+
This function iterates over the configured contributions in the settings and yields
|
9
|
+
the paths to the 'models' directories for each contribution.
|
10
|
+
|
11
|
+
Returns:
|
12
|
+
Generator[Path, None, None]: A generator that yields paths to the 'models' directories
|
13
|
+
of the configured contributions.
|
14
|
+
"""
|
@@ -0,0 +1,440 @@
|
|
1
|
+
import amsdal_glue as glue
|
2
|
+
from amsdal_data.application import AsyncDataApplication
|
3
|
+
from amsdal_data.application import DataApplication
|
4
|
+
from amsdal_data.transactions.decorators import async_transaction
|
5
|
+
from amsdal_data.transactions.decorators import transaction
|
6
|
+
from amsdal_data.transactions.errors import AmsdalTransactionError
|
7
|
+
from amsdal_models.classes.class_manager import ClassManager
|
8
|
+
from amsdal_models.querysets.executor import LAKEHOUSE_DB_ALIAS
|
9
|
+
|
10
|
+
|
11
|
+
@transaction
|
12
|
+
def rollback_to_timestamp(timestamp: float) -> None:
|
13
|
+
"""
|
14
|
+
Rollback the data to the given timestamp
|
15
|
+
Args:
|
16
|
+
timestamp (float): The timestamp to rollback the data to.
|
17
|
+
Returns:
|
18
|
+
None
|
19
|
+
"""
|
20
|
+
class_manager = ClassManager()
|
21
|
+
|
22
|
+
lakehouse_connection = (
|
23
|
+
DataApplication()._application.lakehouse_connection_manager.get_connection_pool('Company').get_connection()
|
24
|
+
)
|
25
|
+
|
26
|
+
metadatas_to_delete = lakehouse_connection.query(
|
27
|
+
query=glue.QueryStatement(
|
28
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
29
|
+
where=glue.Conditions(
|
30
|
+
glue.Condition(
|
31
|
+
left=glue.FieldReferenceExpression(
|
32
|
+
field_reference=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
33
|
+
),
|
34
|
+
lookup=glue.FieldLookup.GT,
|
35
|
+
right=glue.Value(timestamp),
|
36
|
+
),
|
37
|
+
glue.Condition(
|
38
|
+
left=glue.FieldReferenceExpression(
|
39
|
+
field_reference=glue.FieldReference(
|
40
|
+
field=glue.Field(name='prior_version'),
|
41
|
+
table_name='Metadata',
|
42
|
+
),
|
43
|
+
),
|
44
|
+
lookup=glue.FieldLookup.ISNULL,
|
45
|
+
right=glue.Value(True),
|
46
|
+
),
|
47
|
+
),
|
48
|
+
)
|
49
|
+
)
|
50
|
+
|
51
|
+
ids_to_ignore = [m.data['object_id'] for m in metadatas_to_delete]
|
52
|
+
|
53
|
+
metadatas_to_revert = lakehouse_connection.query(
|
54
|
+
query=glue.QueryStatement(
|
55
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
56
|
+
where=glue.Conditions(
|
57
|
+
glue.Condition(
|
58
|
+
left=glue.FieldReferenceExpression(
|
59
|
+
field_reference=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
60
|
+
),
|
61
|
+
lookup=glue.FieldLookup.GT,
|
62
|
+
right=glue.Value(timestamp),
|
63
|
+
),
|
64
|
+
glue.Condition(
|
65
|
+
left=glue.FieldReferenceExpression(
|
66
|
+
field_reference=glue.FieldReference(
|
67
|
+
field=glue.Field(name='prior_version'),
|
68
|
+
table_name='Metadata',
|
69
|
+
),
|
70
|
+
),
|
71
|
+
lookup=glue.FieldLookup.ISNULL,
|
72
|
+
right=glue.Value(False),
|
73
|
+
),
|
74
|
+
),
|
75
|
+
)
|
76
|
+
)
|
77
|
+
|
78
|
+
transaction_ids = {m.data['transaction']['ref']['object_id'] for m in metadatas_to_revert}
|
79
|
+
transaction_ids.update({m.data['transaction']['ref']['object_id'] for m in metadatas_to_delete})
|
80
|
+
ids_to_revert = [
|
81
|
+
(m.data['object_id'], m.data['class_schema_reference']['ref']['object_id'])
|
82
|
+
for m in metadatas_to_revert
|
83
|
+
if m.data['object_id'] not in ids_to_ignore
|
84
|
+
]
|
85
|
+
|
86
|
+
if transaction_ids:
|
87
|
+
_conditions = []
|
88
|
+
for transaction_id in transaction_ids:
|
89
|
+
_parent_field = glue.Field(
|
90
|
+
name='transaction',
|
91
|
+
child=glue.Field(
|
92
|
+
name='ref',
|
93
|
+
child=glue.Field(name='object_id'),
|
94
|
+
),
|
95
|
+
)
|
96
|
+
_parent_field.child.parent = _parent_field # type: ignore[union-attr]
|
97
|
+
_parent_field.child.child.parent = _parent_field.child # type: ignore[union-attr]
|
98
|
+
_conditions.append(
|
99
|
+
glue.Condition(
|
100
|
+
left=glue.FieldReferenceExpression(
|
101
|
+
field_reference=glue.FieldReference(field=_parent_field, table_name='Metadata'),
|
102
|
+
output_type=str,
|
103
|
+
),
|
104
|
+
lookup=glue.FieldLookup.EQ,
|
105
|
+
right=glue.Value(transaction_id, output_type=str),
|
106
|
+
)
|
107
|
+
)
|
108
|
+
|
109
|
+
conflict_metadata = lakehouse_connection.query(
|
110
|
+
query=glue.QueryStatement(
|
111
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
112
|
+
where=glue.Conditions(
|
113
|
+
glue.Condition(
|
114
|
+
left=glue.FieldReferenceExpression(
|
115
|
+
field_reference=glue.FieldReference(
|
116
|
+
field=glue.Field(name='updated_at'),
|
117
|
+
table_name='Metadata',
|
118
|
+
),
|
119
|
+
),
|
120
|
+
lookup=glue.FieldLookup.LTE,
|
121
|
+
right=glue.Value(timestamp),
|
122
|
+
),
|
123
|
+
glue.Conditions(*_conditions, connector=glue.FilterConnector.OR),
|
124
|
+
),
|
125
|
+
)
|
126
|
+
)
|
127
|
+
if conflict_metadata:
|
128
|
+
msg = 'Cannot rollback to this timestamp because it will conflict with other transactions'
|
129
|
+
raise AmsdalTransactionError(msg)
|
130
|
+
|
131
|
+
for m in metadatas_to_delete:
|
132
|
+
class_name = m.data['class_schema_reference']['ref']['object_id']
|
133
|
+
model_class = class_manager.import_class(class_name)
|
134
|
+
obj = (
|
135
|
+
model_class.objects.filter(_address__object_id=m.data['object_id'])
|
136
|
+
.using(LAKEHOUSE_DB_ALIAS)
|
137
|
+
.latest()
|
138
|
+
.first()
|
139
|
+
.execute()
|
140
|
+
)
|
141
|
+
|
142
|
+
if obj and not obj.get_metadata().is_deleted:
|
143
|
+
obj.delete()
|
144
|
+
|
145
|
+
for object_id, class_name in ids_to_revert:
|
146
|
+
model_class = class_manager.import_class(class_name)
|
147
|
+
|
148
|
+
obj = (
|
149
|
+
model_class.objects.filter(_address__object_id=object_id)
|
150
|
+
.using(LAKEHOUSE_DB_ALIAS)
|
151
|
+
.latest()
|
152
|
+
.first()
|
153
|
+
.execute()
|
154
|
+
)
|
155
|
+
old_obj = obj.previous_version() # type: ignore[union-attr]
|
156
|
+
# old_obj = (
|
157
|
+
# model_class.objects.filter(_address__object_id=object_id, _metadata__updated_at__lte=timestamp)
|
158
|
+
# .using(LAKEHOUSE_DB_ALIAS)
|
159
|
+
# .order_by('-_metadata__updated_at')
|
160
|
+
# .first()
|
161
|
+
# .execute()
|
162
|
+
# )
|
163
|
+
|
164
|
+
if obj and old_obj:
|
165
|
+
for field, value in old_obj.model_dump().items():
|
166
|
+
setattr(obj, field, value)
|
167
|
+
|
168
|
+
obj.save()
|
169
|
+
|
170
|
+
if old_obj.get_metadata().is_deleted:
|
171
|
+
obj.delete()
|
172
|
+
|
173
|
+
|
174
|
+
@transaction
|
175
|
+
def rollback_transaction(transaction_id: str) -> None:
|
176
|
+
"""
|
177
|
+
Rollback the data to the point in time before the given transaction
|
178
|
+
Args:
|
179
|
+
transaction_id (str): The transaction ID to rollback the data to.
|
180
|
+
Returns:
|
181
|
+
None
|
182
|
+
"""
|
183
|
+
|
184
|
+
lakehouse_connection = (
|
185
|
+
DataApplication()._application.lakehouse_connection_manager.get_connection_pool('Company').get_connection()
|
186
|
+
)
|
187
|
+
|
188
|
+
_parent_field = glue.Field(
|
189
|
+
name='transaction',
|
190
|
+
child=glue.Field(
|
191
|
+
name='ref',
|
192
|
+
child=glue.Field(name='object_id'),
|
193
|
+
),
|
194
|
+
)
|
195
|
+
_parent_field.child.parent = _parent_field # type: ignore[union-attr]
|
196
|
+
_parent_field.child.child.parent = _parent_field.child # type: ignore[union-attr]
|
197
|
+
|
198
|
+
metadatas_to_revert = lakehouse_connection.query(
|
199
|
+
query=glue.QueryStatement(
|
200
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
201
|
+
where=glue.Conditions(
|
202
|
+
glue.Condition(
|
203
|
+
left=glue.FieldReferenceExpression(
|
204
|
+
field_reference=glue.FieldReference(field=_parent_field, table_name='Metadata'),
|
205
|
+
output_type=str,
|
206
|
+
),
|
207
|
+
lookup=glue.FieldLookup.EQ,
|
208
|
+
right=glue.Value(transaction_id, output_type=str),
|
209
|
+
)
|
210
|
+
),
|
211
|
+
order_by=[
|
212
|
+
glue.OrderByQuery(
|
213
|
+
field=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
214
|
+
direction=glue.OrderDirection.DESC,
|
215
|
+
)
|
216
|
+
],
|
217
|
+
)
|
218
|
+
)
|
219
|
+
|
220
|
+
if not metadatas_to_revert:
|
221
|
+
msg = 'Transaction not found'
|
222
|
+
raise AmsdalTransactionError(msg)
|
223
|
+
|
224
|
+
updated_at = metadatas_to_revert[0].data['updated_at']
|
225
|
+
rollback_to_timestamp(updated_at)
|
226
|
+
|
227
|
+
|
228
|
+
@async_transaction
|
229
|
+
async def async_rollback_to_timestamp(timestamp: float) -> None:
|
230
|
+
"""
|
231
|
+
Rollback the data to the given timestamp
|
232
|
+
Args:
|
233
|
+
timestamp (float): The timestamp to rollback the data to.
|
234
|
+
Returns:
|
235
|
+
None
|
236
|
+
"""
|
237
|
+
class_manager = ClassManager()
|
238
|
+
|
239
|
+
lakehouse_connection = await (
|
240
|
+
AsyncDataApplication()._application.lakehouse_connection_manager.get_connection_pool('Company').get_connection()
|
241
|
+
)
|
242
|
+
|
243
|
+
metadatas_to_delete = await lakehouse_connection.query(
|
244
|
+
query=glue.QueryStatement(
|
245
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
246
|
+
where=glue.Conditions(
|
247
|
+
glue.Condition(
|
248
|
+
left=glue.FieldReferenceExpression(
|
249
|
+
field_reference=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
250
|
+
),
|
251
|
+
lookup=glue.FieldLookup.GT,
|
252
|
+
right=glue.Value(timestamp),
|
253
|
+
),
|
254
|
+
glue.Condition(
|
255
|
+
left=glue.FieldReferenceExpression(
|
256
|
+
field_reference=glue.FieldReference(
|
257
|
+
field=glue.Field(name='prior_version'),
|
258
|
+
table_name='Metadata',
|
259
|
+
),
|
260
|
+
),
|
261
|
+
lookup=glue.FieldLookup.ISNULL,
|
262
|
+
right=glue.Value(True),
|
263
|
+
),
|
264
|
+
),
|
265
|
+
)
|
266
|
+
)
|
267
|
+
|
268
|
+
ids_to_ignore = [m.data['object_id'] for m in metadatas_to_delete]
|
269
|
+
|
270
|
+
metadatas_to_revert = await lakehouse_connection.query(
|
271
|
+
query=glue.QueryStatement(
|
272
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
273
|
+
where=glue.Conditions(
|
274
|
+
glue.Condition(
|
275
|
+
left=glue.FieldReferenceExpression(
|
276
|
+
field_reference=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
277
|
+
),
|
278
|
+
lookup=glue.FieldLookup.GT,
|
279
|
+
right=glue.Value(timestamp),
|
280
|
+
),
|
281
|
+
glue.Condition(
|
282
|
+
left=glue.FieldReferenceExpression(
|
283
|
+
field_reference=glue.FieldReference(
|
284
|
+
field=glue.Field(name='prior_version'), table_name='Metadata'
|
285
|
+
),
|
286
|
+
),
|
287
|
+
lookup=glue.FieldLookup.ISNULL,
|
288
|
+
right=glue.Value(False),
|
289
|
+
),
|
290
|
+
),
|
291
|
+
)
|
292
|
+
)
|
293
|
+
|
294
|
+
transaction_ids = {m.data['transaction']['ref']['object_id'] for m in metadatas_to_revert}
|
295
|
+
transaction_ids.update({m.data['transaction']['ref']['object_id'] for m in metadatas_to_delete})
|
296
|
+
ids_to_revert = [
|
297
|
+
(m.data['object_id'], m.data['class_schema_reference']['ref']['object_id'])
|
298
|
+
for m in metadatas_to_revert
|
299
|
+
if m.data['object_id'] not in ids_to_ignore
|
300
|
+
]
|
301
|
+
|
302
|
+
if transaction_ids:
|
303
|
+
_conditions = []
|
304
|
+
for transaction_id in transaction_ids:
|
305
|
+
_parent_field = glue.Field(
|
306
|
+
name='transaction',
|
307
|
+
child=glue.Field(
|
308
|
+
name='ref',
|
309
|
+
child=glue.Field(name='object_id'),
|
310
|
+
),
|
311
|
+
)
|
312
|
+
_parent_field.child.parent = _parent_field # type: ignore[union-attr]
|
313
|
+
_parent_field.child.child.parent = _parent_field.child # type: ignore[union-attr]
|
314
|
+
_conditions.append(
|
315
|
+
glue.Condition(
|
316
|
+
left=glue.FieldReferenceExpression(
|
317
|
+
field_reference=glue.FieldReference(field=_parent_field, table_name='Metadata'),
|
318
|
+
output_type=str,
|
319
|
+
),
|
320
|
+
lookup=glue.FieldLookup.EQ,
|
321
|
+
right=glue.Value(transaction_id, output_type=str),
|
322
|
+
)
|
323
|
+
)
|
324
|
+
|
325
|
+
conflict_metadata = await lakehouse_connection.query(
|
326
|
+
query=glue.QueryStatement(
|
327
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
328
|
+
where=glue.Conditions(
|
329
|
+
glue.Condition(
|
330
|
+
left=glue.FieldReferenceExpression(
|
331
|
+
field_reference=glue.FieldReference(
|
332
|
+
field=glue.Field(name='updated_at'),
|
333
|
+
table_name='Metadata',
|
334
|
+
),
|
335
|
+
),
|
336
|
+
lookup=glue.FieldLookup.LTE,
|
337
|
+
right=glue.Value(timestamp),
|
338
|
+
),
|
339
|
+
glue.Conditions(*_conditions, connector=glue.FilterConnector.OR),
|
340
|
+
),
|
341
|
+
)
|
342
|
+
)
|
343
|
+
if conflict_metadata:
|
344
|
+
msg = 'Cannot rollback to this timestamp because it will conflict with other transactions'
|
345
|
+
raise AmsdalTransactionError(msg)
|
346
|
+
|
347
|
+
for m in metadatas_to_delete:
|
348
|
+
class_name = m.data['class_schema_reference']['ref']['object_id']
|
349
|
+
model_class = class_manager.import_class(class_name)
|
350
|
+
obj = await (
|
351
|
+
model_class.objects.filter(_address__object_id=m.data['object_id'])
|
352
|
+
.using(LAKEHOUSE_DB_ALIAS)
|
353
|
+
.latest()
|
354
|
+
.first()
|
355
|
+
.aexecute()
|
356
|
+
)
|
357
|
+
|
358
|
+
if obj and not (await obj.aget_metadata()).is_deleted:
|
359
|
+
await obj.adelete()
|
360
|
+
|
361
|
+
for object_id, class_name in ids_to_revert:
|
362
|
+
model_class = class_manager.import_class(class_name)
|
363
|
+
|
364
|
+
obj = await (
|
365
|
+
model_class.objects.filter(_address__object_id=object_id)
|
366
|
+
.using(LAKEHOUSE_DB_ALIAS)
|
367
|
+
.latest()
|
368
|
+
.first()
|
369
|
+
.aexecute()
|
370
|
+
)
|
371
|
+
old_obj = await obj.aprevious_version() # type: ignore[union-attr]
|
372
|
+
# old_obj = await (
|
373
|
+
# model_class.objects.filter(_address__object_id=object_id, _metadata__updated_at__lte=timestamp)
|
374
|
+
# .using(LAKEHOUSE_DB_ALIAS)
|
375
|
+
# .order_by('-_metadata__updated_at')
|
376
|
+
# .first()
|
377
|
+
# .aexecute()
|
378
|
+
# )
|
379
|
+
|
380
|
+
if obj and old_obj:
|
381
|
+
for field, value in (await old_obj.amodel_dump()).items():
|
382
|
+
setattr(obj, field, value)
|
383
|
+
|
384
|
+
await obj.asave()
|
385
|
+
|
386
|
+
if (await old_obj.aget_metadata()).is_deleted:
|
387
|
+
await obj.adelete()
|
388
|
+
|
389
|
+
|
390
|
+
@async_transaction
|
391
|
+
async def async_rollback_transaction(transaction_id: str) -> None:
|
392
|
+
"""
|
393
|
+
Rollback the data to the point in time before the given transaction
|
394
|
+
Args:
|
395
|
+
transaction_id (str): The transaction ID to rollback the data to.
|
396
|
+
Returns:
|
397
|
+
None
|
398
|
+
"""
|
399
|
+
lakehouse_connection = await (
|
400
|
+
AsyncDataApplication()._application.lakehouse_connection_manager.get_connection_pool('Company').get_connection()
|
401
|
+
)
|
402
|
+
|
403
|
+
_parent_field = glue.Field(
|
404
|
+
name='transaction',
|
405
|
+
child=glue.Field(
|
406
|
+
name='ref',
|
407
|
+
child=glue.Field(name='object_id'),
|
408
|
+
),
|
409
|
+
)
|
410
|
+
_parent_field.child.parent = _parent_field # type: ignore[union-attr]
|
411
|
+
_parent_field.child.child.parent = _parent_field.child # type: ignore[union-attr]
|
412
|
+
|
413
|
+
metadatas_to_revert = await lakehouse_connection.query(
|
414
|
+
query=glue.QueryStatement(
|
415
|
+
table=glue.SchemaReference(name='Metadata', version=glue.Version.LATEST),
|
416
|
+
where=glue.Conditions(
|
417
|
+
glue.Condition(
|
418
|
+
left=glue.FieldReferenceExpression(
|
419
|
+
field_reference=glue.FieldReference(field=_parent_field, table_name='Metadata'),
|
420
|
+
output_type=str,
|
421
|
+
),
|
422
|
+
lookup=glue.FieldLookup.EQ,
|
423
|
+
right=glue.Value(transaction_id, output_type=str),
|
424
|
+
)
|
425
|
+
),
|
426
|
+
order_by=[
|
427
|
+
glue.OrderByQuery(
|
428
|
+
field=glue.FieldReference(field=glue.Field(name='updated_at'), table_name='Metadata'),
|
429
|
+
direction=glue.OrderDirection.DESC,
|
430
|
+
)
|
431
|
+
],
|
432
|
+
)
|
433
|
+
)
|
434
|
+
|
435
|
+
if not metadatas_to_revert:
|
436
|
+
msg = 'Transaction not found'
|
437
|
+
raise AmsdalTransactionError(msg)
|
438
|
+
|
439
|
+
updated_at = metadatas_to_revert[0].data['updated_at']
|
440
|
+
await async_rollback_to_timestamp(updated_at) # type: ignore[misc]
|
@@ -0,0 +1,38 @@
|
|
1
|
+
from amsdal_data.transactions.decorators import async_transaction, transaction
|
2
|
+
|
3
|
+
@transaction
|
4
|
+
def rollback_to_timestamp(timestamp: float) -> None:
|
5
|
+
"""
|
6
|
+
Rollback the data to the given timestamp
|
7
|
+
Args:
|
8
|
+
timestamp (float): The timestamp to rollback the data to.
|
9
|
+
Returns:
|
10
|
+
None
|
11
|
+
"""
|
12
|
+
@transaction
|
13
|
+
def rollback_transaction(transaction_id: str) -> None:
|
14
|
+
"""
|
15
|
+
Rollback the data to the point in time before the given transaction
|
16
|
+
Args:
|
17
|
+
transaction_id (str): The transaction ID to rollback the data to.
|
18
|
+
Returns:
|
19
|
+
None
|
20
|
+
"""
|
21
|
+
@async_transaction
|
22
|
+
async def async_rollback_to_timestamp(timestamp: float) -> None:
|
23
|
+
"""
|
24
|
+
Rollback the data to the given timestamp
|
25
|
+
Args:
|
26
|
+
timestamp (float): The timestamp to rollback the data to.
|
27
|
+
Returns:
|
28
|
+
None
|
29
|
+
"""
|
30
|
+
@async_transaction
|
31
|
+
async def async_rollback_transaction(transaction_id: str) -> None:
|
32
|
+
"""
|
33
|
+
Rollback the data to the point in time before the given transaction
|
34
|
+
Args:
|
35
|
+
transaction_id (str): The transaction ID to rollback the data to.
|
36
|
+
Returns:
|
37
|
+
None
|
38
|
+
"""
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
from enum import Enum
|
2
|
+
|
3
|
+
|
4
|
+
class DbExecutionType(str, Enum):
|
5
|
+
lakehouse_only = 'lakehouse_only'
|
6
|
+
include_state_db = 'include_state_db'
|
7
|
+
|
8
|
+
|
9
|
+
class StateOption(str, Enum):
|
10
|
+
sqlite = 'sqlite'
|
11
|
+
postgres = 'postgres'
|
12
|
+
|
13
|
+
|
14
|
+
class LakehouseOption(str, Enum):
|
15
|
+
postgres = 'postgres'
|
16
|
+
postgres_immutable = 'postgres-immutable'
|
17
|
+
sqlite = 'sqlite'
|
18
|
+
sqlite_immutable = 'sqlite-immutable'
|