amochka 0.3.3__py3-none-any.whl → 0.3.5__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.
- {amochka-0.3.3.dist-info → amochka-0.3.5.dist-info}/METADATA +1 -1
- {amochka-0.3.3.dist-info → amochka-0.3.5.dist-info}/RECORD +6 -6
- etl/extractors.py +5 -5
- etl/run_etl.py +10 -0
- {amochka-0.3.3.dist-info → amochka-0.3.5.dist-info}/WHEEL +0 -0
- {amochka-0.3.3.dist-info → amochka-0.3.5.dist-info}/top_level.txt +0 -0
|
@@ -3,12 +3,12 @@ amochka/client.py,sha256=6QMOem31Zs7Ks6CeEQYZ8VWrB1bM47NnxV103a8jDg8,70972
|
|
|
3
3
|
amochka/etl.py,sha256=N8rXNFbtmlKfsYpgr7HDcP4enoj63XQPWuTDxGuMhw4,8901
|
|
4
4
|
etl/__init__.py,sha256=bp9fPqbKlOc7xzs27diHEvysy1FgBrwlpX6GnR6GL9U,255
|
|
5
5
|
etl/config.py,sha256=BvaGn5BSGMIfvUNNsnap04iy3BHyMOuRX81G7EiLUfE,9032
|
|
6
|
-
etl/extractors.py,sha256=
|
|
6
|
+
etl/extractors.py,sha256=PqjzlmUa8FLZa1z85mP6Y0-s_TH3REqW58632JzRKUc,13047
|
|
7
7
|
etl/loaders.py,sha256=x8PcDQoq2kjbd52H2VzKKz5vHzyD6DXSsb9X0foPX_U,31941
|
|
8
|
-
etl/run_etl.py,sha256=
|
|
8
|
+
etl/run_etl.py,sha256=LxKQLE_yUPkg7kaFmmMxrdggz27puS1VdV9NTna9e4Q,26665
|
|
9
9
|
etl/transformers.py,sha256=OwYJ_9l3oqvy2Y3-umXjAGweOIqlfRI0iSiCFPrcQ8E,17867
|
|
10
10
|
etl/migrations/001_create_tables.sql,sha256=YrSaZjpofC1smjYx0bM4eHQumboruIBY3fwRDlJLLSo,15749
|
|
11
|
-
amochka-0.3.
|
|
12
|
-
amochka-0.3.
|
|
13
|
-
amochka-0.3.
|
|
14
|
-
amochka-0.3.
|
|
11
|
+
amochka-0.3.5.dist-info/METADATA,sha256=It10dOYYGOkbKzAZmg25wZhPH2Yxgt1Wcm1Jb28wV1U,7530
|
|
12
|
+
amochka-0.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
amochka-0.3.5.dist-info/top_level.txt,sha256=grRX8aLFG-yYKPsAqCD6sUBmdLSQeOMHsc9Dl6S7Lzo,12
|
|
14
|
+
amochka-0.3.5.dist-info/RECORD,,
|
etl/extractors.py
CHANGED
|
@@ -206,10 +206,10 @@ class AmoCRMExtractor:
|
|
|
206
206
|
|
|
207
207
|
count = 0
|
|
208
208
|
for event in self.client.iter_events(
|
|
209
|
-
|
|
209
|
+
entity=entity_type, # client.py использует 'entity', не 'entity_type'
|
|
210
210
|
event_type=event_types[0] if event_types and len(event_types) == 1 else None,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
created_from=created_from,
|
|
212
|
+
created_to=created_to,
|
|
213
213
|
):
|
|
214
214
|
# Фильтруем по типам если указано несколько
|
|
215
215
|
if event_types and len(event_types) > 1:
|
|
@@ -255,8 +255,8 @@ class AmoCRMExtractor:
|
|
|
255
255
|
for note in self.client.iter_notes(
|
|
256
256
|
entity=entity_type,
|
|
257
257
|
note_type=note_type,
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
updated_from=updated_from,
|
|
259
|
+
updated_to=updated_to,
|
|
260
260
|
):
|
|
261
261
|
count += 1
|
|
262
262
|
if count % 100 == 0:
|
etl/run_etl.py
CHANGED
|
@@ -199,6 +199,8 @@ def mark_deleted_leads(
|
|
|
199
199
|
loader: PostgresLoader,
|
|
200
200
|
mybi_account_id: int,
|
|
201
201
|
pipeline_ids: Optional[List[int]] = None,
|
|
202
|
+
updated_from: Optional[datetime] = None,
|
|
203
|
+
updated_to: Optional[datetime] = None,
|
|
202
204
|
) -> int:
|
|
203
205
|
"""
|
|
204
206
|
Помечает удалённые сделки в БД (is_deleted = true).
|
|
@@ -206,12 +208,18 @@ def mark_deleted_leads(
|
|
|
206
208
|
Выгружает список удалённых сделок из amoCRM (корзина) и обновляет
|
|
207
209
|
соответствующие записи в БД.
|
|
208
210
|
|
|
211
|
+
Args:
|
|
212
|
+
updated_from: Начало периода (фильтр по deleted_at)
|
|
213
|
+
updated_to: Конец периода (фильтр по deleted_at)
|
|
214
|
+
|
|
209
215
|
Returns:
|
|
210
216
|
Количество помеченных сделок
|
|
211
217
|
"""
|
|
212
218
|
# Выгружаем ID удалённых сделок из amoCRM
|
|
213
219
|
deleted_lead_ids = []
|
|
214
220
|
for lead in extractor.iter_leads(
|
|
221
|
+
updated_from=updated_from,
|
|
222
|
+
updated_to=updated_to,
|
|
215
223
|
pipeline_ids=pipeline_ids,
|
|
216
224
|
only_deleted=True,
|
|
217
225
|
):
|
|
@@ -538,6 +546,8 @@ def run_etl_for_account(
|
|
|
538
546
|
loader,
|
|
539
547
|
mybi_id,
|
|
540
548
|
pipeline_ids=account.pipeline_ids,
|
|
549
|
+
updated_from=leads_updated_from,
|
|
550
|
+
updated_to=updated_to,
|
|
541
551
|
)
|
|
542
552
|
stats["leads_marked_deleted"] = deleted_count
|
|
543
553
|
|
|
File without changes
|
|
File without changes
|