init: Prefect ETL sync project (RIIN/SDS → PG) with 12 sync flows

This commit is contained in:
yeuimu
2026-07-23 08:13:09 +00:00
commit 4cba1da4e1
41 changed files with 6219 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
"""批量切分辅助:对应 TS SDK 里订单 OID/快递单号、SDS 订单关键词的批量拆分。"""
from __future__ import annotations
import re
_MULTI_SEP = re.compile(r"[,,\s\n\r]+")
def parse_id_text(text: str) -> list[str]:
"""把逗号/空白/换行分隔的字符串解析为去重的 ID 列表(RIIN 用)。"""
items = _MULTI_SEP.split(text or "")
seen: dict[str, None] = {}
for item in items:
item = item.strip()
if item and item not in seen:
seen[item] = None
return list(seen.keys())
def split_lines(text: str) -> list[str]:
"""把换行分隔的字符串解析为去重的列表(SDS 订单号 keywords 用)。"""
items = re.split(r"[\n\r]+", text or "")
seen: dict[str, None] = {}
for item in items:
item = item.strip()
if item and item not in seen:
seen[item] = None
return list(seen.keys())
def chunk(items: list[str], size: int) -> list[list[str]]:
"""把列表按 size 切成多批。"""
if not items:
return []
return [items[i : i + size] for i in range(0, len(items), size)]