adapter-engine-execution 0.0.1__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.
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.1
2
+ Name: adapter-engine-execution
3
+ Version: 0.0.1
4
+ Summary: adapter execution for account engine
5
+ Author-email: deepfos-python-team <deepfos_py@deepfinance.com>
6
+ Keywords: adapter engine execution
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: orjson (==3.10.6)
11
+ Requires-Dist: pydantic (!=1.10.7,<2,>1.10.0)
12
+ Requires-Dist: polars (~=1.37.0)
13
+ Requires-Dist: edgedb (~=1.4.0)
14
+ Provides-Extra: all
15
+ Requires-Dist: adapter-engine-execution[benchmark,test] ; extra == 'all'
16
+ Provides-Extra: benchmark
17
+ Requires-Dist: asv ; extra == 'benchmark'
18
+ Provides-Extra: test
19
+ Requires-Dist: pytest ; extra == 'test'
20
+
21
+ # adapter-engine-execution
22
+
23
+ 对内使用的 **单据引擎执行适配层**:根据已构建的 `ExecutionPlan`,连接 EdgeDB、拉取 DeepModel 元数据,用 Polars 执行计划并返回行数据(可选返回列 schema)。
24
+
25
+ - **PyPI 包名**:`adapter-engine-execution`
26
+ - **导入包名**:`adapter_execution`
27
+ - **Python**:>= 3.11
28
+
29
+ ## 安装
30
+
31
+ ```bash
32
+ pip install adapter-engine-execution
33
+ ```
34
+
35
+ 本地安装:
36
+
37
+ ```bash
38
+ pip install -e .
39
+ ```
40
+
41
+ ## 主要 API
42
+
43
+ 从包入口可导入:
44
+
45
+ ```python
46
+ from adapter_execution import execute_plan
47
+ ```
@@ -0,0 +1,16 @@
1
+ adapter_execution/__init__.py,sha256=hsIvIHdtAKG8kAXDGWAnsAyD4bEqpdYMDhUYRGQNUk4,1984
2
+ adapter_execution/execution/__init__.py,sha256=j-777zgjnfxCnJjTR_IQdnWIswi8rrJzwEaLOoXeO4g,128
3
+ adapter_execution/execution/bizrule.py,sha256=f8ByKBxpmmH2mdR653oamZdLFqC4ZbcxjLvFxZSOIDs,17977
4
+ adapter_execution/execution/edb2polars.py,sha256=APis_y5okxXk9CrDINrCFU2hDbeDWpDc0gekF9xsVlo,1574
5
+ adapter_execution/execution/eql.py,sha256=Xpa3a4NbkkYx2mzueBcU8mfneCnfTfVGKyob30ReVgQ,6399
6
+ adapter_execution/execution/plan.py,sha256=GmEF70yKC8OH0PQ4cUq8o0EbMUqBFbIBODoIb6KUgkw,16852
7
+ adapter_execution/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ adapter_execution/lib/serutils.py,sha256=s_x5BRVMxhx7hTgrhXkZgyNekcvQHz0-5vZLINJf5Co,4968
9
+ adapter_execution/models/__init__.py,sha256=ru77_zzaFQPx-E-eHdjDG1Tb_hJcyRvG5_tYZ295-A8,36
10
+ adapter_execution/models/base.py,sha256=0ZcHmd49ZHsr-LwUeXM0BPzMvf5ynOryGKr2qJtff7g,7558
11
+ adapter_execution/models/deepmodel.py,sha256=VSuKuNcxc8SjsM2j00KIoYjVKay_OiUln_-EnOFuKFg,3946
12
+ adapter_execution/models/execution.py,sha256=48P9jItNGvbPGireKlPr9yYbNO_0Vt0zq8MmUKl0XwE,1136
13
+ adapter_engine_execution-0.0.1.dist-info/METADATA,sha256=XuNDBhM1ZJaJr1Az0dpZBtJymKM7BmerYUF2LCJaJmk,1293
14
+ adapter_engine_execution-0.0.1.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
15
+ adapter_engine_execution-0.0.1.dist-info/top_level.txt,sha256=an38hL1YTuximFRF6EECree0PtPTrOyENW13CzZ4GvU,18
16
+ adapter_engine_execution-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.38.4)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ adapter_execution
@@ -0,0 +1,71 @@
1
+ from typing import Dict, List, Any, Tuple
2
+
3
+ from .execution import (
4
+ ExecutionPlan,
5
+ DeepModelAPIProtocol,
6
+ PolarsType,
7
+ EdgeQLQuery
8
+ )
9
+ from .models import FieldSchema
10
+
11
+ try:
12
+ from ._version import __version__, __version_tuple__
13
+ except ImportError:
14
+ __version__ = 'unknown'
15
+ __version_tuple__ = ()
16
+
17
+ DataPayload = List[Dict[str, Any]]
18
+
19
+
20
+ def execute_plan(
21
+ exec_plan: ExecutionPlan,
22
+ edgedb_dsn: str,
23
+ edgedb_dbname: str,
24
+ default_module: str,
25
+ enable_lazy_frame: bool,
26
+ header: Dict,
27
+ deepmodel_api: DeepModelAPIProtocol,
28
+ advance_sequence: bool = True,
29
+ with_schema: bool = False,
30
+ eql_result: Any = None,
31
+ params: Dict[str, Any] = None,
32
+ with_globals: Dict[str, Any] = None,
33
+ without_globals: List[str] = None,
34
+ ) -> Tuple[DataPayload, List[FieldSchema], Dict[str, Dict]] | DataPayload:
35
+ from .execution import ExecutionContext
36
+ exec_ctx = ExecutionContext(
37
+ edgedb_dsn=edgedb_dsn,
38
+ edgedb_dbname=edgedb_dbname,
39
+ default_module=default_module,
40
+ plans=exec_plan.extract_subplan(),
41
+ enable_lazy_frame=enable_lazy_frame,
42
+ eql_result=eql_result,
43
+ headers=header,
44
+ advance_sequence=advance_sequence,
45
+ deepmodel_api=deepmodel_api,
46
+ params=params,
47
+ with_globals=with_globals,
48
+ without_globals=without_globals,
49
+ )
50
+
51
+ df = exec_plan.execute(exec_ctx)
52
+ if exec_ctx.enable_lazy_frame:
53
+ df = df.collect()
54
+
55
+ if not with_schema:
56
+ return df.to_dicts()
57
+
58
+ schema = {
59
+ k: PolarsType.from_pltype(v)
60
+ for k, v in df.schema.items()
61
+ }
62
+ human_readable_schema = [
63
+ FieldSchema.from_polars_type(name, plt)
64
+ for name, plt in schema.items()
65
+ ]
66
+ ser_schema = {
67
+ k: v.dict(exclude_unset=True, exclude_defaults=True)
68
+ for k, v in schema.items()
69
+ }
70
+ return df.to_dicts(), human_readable_schema, ser_schema
71
+
@@ -0,0 +1,7 @@
1
+ from .plan import (
2
+ ExecutionContext,
3
+ ExecutionPlan,
4
+ DeepModelAPIProtocol,
5
+ PolarsType,
6
+ EdgeQLQuery
7
+ )