arpakitlib 1.7.232__py3-none-any.whl → 1.7.233__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.
@@ -1,18 +1,25 @@
1
1
  import importlib
2
2
  from contextlib import suppress
3
3
  from functools import lru_cache
4
+ from typing import Any
4
5
 
5
6
  from arpakitlib.ar_sqlalchemy_util import SQLAlchemyDB
6
7
  from src.core.settings import get_cached_settings
7
8
 
8
9
 
9
- def create_sqlalchemy_db() -> SQLAlchemyDB:
10
+ def get_base_dbm() -> Any:
10
11
  with suppress(Exception):
11
12
  importlib.import_module("src.db.sqlalchemy_model")
12
13
 
14
+ from arpakitlib.ar_sqlalchemy_model_util import BaseDBM
15
+ return BaseDBM
16
+
17
+
18
+ def create_sqlalchemy_db() -> SQLAlchemyDB:
13
19
  return SQLAlchemyDB(
14
20
  db_url=get_cached_settings().sql_db_url,
15
- db_echo=get_cached_settings().sql_db_echo
21
+ db_echo=get_cached_settings().sql_db_echo,
22
+ base_declarative_base=get_base_dbm()
16
23
  )
17
24
 
18
25
 
@@ -27,15 +27,10 @@ class SQLAlchemyDB:
27
27
  *,
28
28
  db_url: str = "postgresql://arpakitlib:arpakitlib@localhost:50629/arpakitlib",
29
29
  db_echo: bool = False,
30
- need_include_operation_dbm: bool = False,
31
- need_include_story_dbm: bool = False,
32
- db_models: list[Any] | None = None
30
+ base_declarative_base: Any | None = None,
31
+ db_models: list[Any] | None = None,
33
32
  ):
34
33
  self._logger = logging.getLogger(self.__class__.__name__)
35
- self.need_include_operation_dbm = need_include_operation_dbm
36
- self.need_include_story_dbm = need_include_story_dbm
37
- if self.need_include_operation_dbm:
38
- self.need_include_story_dbm = True
39
34
  self.engine = create_engine(
40
35
  url=db_url,
41
36
  echo=db_echo,
@@ -46,6 +41,7 @@ class SQLAlchemyDB:
46
41
  )
47
42
  self.sessionmaker = sessionmaker(bind=self.engine)
48
43
  self.func_new_session_counter = 0
44
+ self.base_declarative_base = base_declarative_base
49
45
 
50
46
  def drop_celery_tables(self):
51
47
  with self.engine.connect() as connection:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: arpakitlib
3
- Version: 1.7.232
3
+ Version: 1.7.233
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
@@ -97,7 +97,7 @@ arpakitlib/_arpakit_project_template/src/db/_init_sqlalchemy_db.py,sha256=tHJ1NB
97
97
  arpakitlib/_arpakit_project_template/src/db/_reinit_sqlalchemy_db.py,sha256=_4O_xr6FXt3qcWOmO82CKG3XX6_RqbqaOYSEygxpBfA,339
98
98
  arpakitlib/_arpakit_project_template/src/db/const.py,sha256=dcvj5C9E2F2KCsGZPBBncQf_EvVJAC1qQgnyD8P4ZEw,6
99
99
  arpakitlib/_arpakit_project_template/src/db/sqlalchemy_model.py,sha256=nXtayUkBaVb6tWx5qJgXZLbLOTVAjnSLpSDxBm7yZLc,234
100
- arpakitlib/_arpakit_project_template/src/db/util.py,sha256=a8lj54I-vVGjhDg4SLOxahDjYuiPOSFxU86myCfE1M0,557
100
+ arpakitlib/_arpakit_project_template/src/db/util.py,sha256=BVOCeZbiTNs-gd35A8o8SDilCeVI4dqrQiJGtxZne9A,734
101
101
  arpakitlib/_arpakit_project_template/src/operation_execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
102
102
  arpakitlib/_arpakit_project_template/src/operation_execution/_remove_operations.py,sha256=KsvAk2zQCp0PX6-QiRW0LKHoJfmH0wVJcBZviFqAoBI,471
103
103
  arpakitlib/_arpakit_project_template/src/operation_execution/_start_operation_executor_worker.py,sha256=K861UI9LFNxfCoPpQ5AJX-oUwjB6bfFNKScKsyU9Xd8,575
@@ -195,14 +195,14 @@ arpakitlib/ar_settings_util.py,sha256=rnoTqbRuhiq7294D4crD5kbnU8-gNWJbwGU_Ls2gJo
195
195
  arpakitlib/ar_sleep_util.py,sha256=OaLtRaJQWMkGjfj_mW1RB2P4RaSWsAIH8LUoXqsH0zM,1061
196
196
  arpakitlib/ar_sqladmin_util.py,sha256=6Nv9VQssk9PB0piyuss__soYKdjVhdbIeXIv4AgUxmQ,2660
197
197
  arpakitlib/ar_sqlalchemy_model_util.py,sha256=DGbXcqD2hukzAiO0aQDUkJ5xOvi3yYnMKzI5y0pMXzs,6217
198
- arpakitlib/ar_sqlalchemy_util.py,sha256=Hcg1THrDsSR_-8dsY1CG3NWPEv0FqCbkPXFXLtjlSJ0,4207
198
+ arpakitlib/ar_sqlalchemy_util.py,sha256=Wh5utY-kITx2-BBjldhNqWCElOzG8fyX9w_Qzvq--W4,3996
199
199
  arpakitlib/ar_ssh_runner_util.py,sha256=e9deuUdBW7Eh0Exx2nTBhk57SaOZYaJaSjNk8q6dbJk,6804
200
200
  arpakitlib/ar_str_util.py,sha256=yU5gOwNXUQaH5b_tM5t6fXUn9oUcv5EQbVnq2wXXIpQ,3378
201
201
  arpakitlib/ar_type_util.py,sha256=9C3ErtUVs0tAUqtK-foFzjJOykfBOntfCz2IogDOgfA,4134
202
202
  arpakitlib/ar_yookassa_api_client_util.py,sha256=VozuZeCJjmLd1zj2BdC9WfiAQ3XYOrIMsdpNK-AUlm0,5347
203
203
  arpakitlib/ar_zabbix_api_client_util.py,sha256=Q-VR4MvoZ9aHwZeYZr9G3LwN-ANx1T5KFmF6pvPM-9M,6402
204
- arpakitlib-1.7.232.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
205
- arpakitlib-1.7.232.dist-info/METADATA,sha256=u5UvnCTGX9axtIbGyffi6UtPY6gVQEpExj4iOmi5qkU,3310
206
- arpakitlib-1.7.232.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
207
- arpakitlib-1.7.232.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
208
- arpakitlib-1.7.232.dist-info/RECORD,,
204
+ arpakitlib-1.7.233.dist-info/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
205
+ arpakitlib-1.7.233.dist-info/METADATA,sha256=yKwdNP8lQ8Q6RcKN_FI5ojDrDlrwUHfsLvx-Md7ix6g,3310
206
+ arpakitlib-1.7.233.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
207
+ arpakitlib-1.7.233.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
208
+ arpakitlib-1.7.233.dist-info/RECORD,,