feldera 0.34.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.
Potentially problematic release.
This version of feldera might be problematic. Click here for more details.
- feldera/__init__.py +11 -0
- feldera/_callback_runner.py +116 -0
- feldera/_helpers.py +104 -0
- feldera/enums.py +234 -0
- feldera/output_handler.py +67 -0
- feldera/pipeline.py +809 -0
- feldera/pipeline_builder.py +109 -0
- feldera/rest/__init__.py +11 -0
- feldera/rest/_httprequests.py +182 -0
- feldera/rest/config.py +26 -0
- feldera/rest/errors.py +58 -0
- feldera/rest/feldera_client.py +605 -0
- feldera/rest/pipeline.py +77 -0
- feldera/rest/sql_table.py +23 -0
- feldera/rest/sql_view.py +23 -0
- feldera/runtime_config.py +78 -0
- feldera-0.34.1.dist-info/METADATA +105 -0
- feldera-0.34.1.dist-info/RECORD +20 -0
- feldera-0.34.1.dist-info/WHEEL +5 -0
- feldera-0.34.1.dist-info/top_level.txt +1 -0
feldera/rest/sql_view.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class SQLView:
|
|
2
|
+
"""
|
|
3
|
+
Represents a SQL view in Feldera
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
def __init__(
|
|
7
|
+
self,
|
|
8
|
+
name: str,
|
|
9
|
+
fields: list[dict],
|
|
10
|
+
case_sensitive: bool = False,
|
|
11
|
+
materialized: bool = False,
|
|
12
|
+
):
|
|
13
|
+
self.name = name
|
|
14
|
+
self.case_sensitive = case_sensitive
|
|
15
|
+
self.materialized = materialized
|
|
16
|
+
self.fields: list[dict] = fields
|
|
17
|
+
|
|
18
|
+
@classmethod
|
|
19
|
+
def from_dict(self, view_dict: dict):
|
|
20
|
+
tbl = SQLView(name=view_dict["name"], fields=view_dict["fields"])
|
|
21
|
+
tbl.case_sensitive = view_dict["case_sensitive"]
|
|
22
|
+
tbl.materialized = view_dict["materialized"]
|
|
23
|
+
return tbl
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from typing import Optional, Any, Mapping
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Resources:
|
|
5
|
+
"""
|
|
6
|
+
Class used to specify the resource configuration for a pipeline.
|
|
7
|
+
|
|
8
|
+
:param config: A dictionary containing all the configuration values.
|
|
9
|
+
:param cpu_cores_max: The maximum number of CPU cores to reserve for an instance of the pipeline.
|
|
10
|
+
:param cpu_cores_min: The minimum number of CPU cores to reserve for an instance of the pipeline.
|
|
11
|
+
:param memory_mb_max: The maximum memory in Megabytes to reserve for an instance of the pipeline.
|
|
12
|
+
:param memory_mb_min: The minimum memory in Megabytes to reserve for an instance of the pipeline.
|
|
13
|
+
:param storage_class: The storage class to use for the pipeline. The class determines storage performance such
|
|
14
|
+
as IOPS and throughput.
|
|
15
|
+
:param storage_mb_max: The storage in Megabytes to reserve for an instance of the pipeline.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
config: Optional[Mapping[str, Any]] = None,
|
|
21
|
+
cpu_cores_max: Optional[int] = None,
|
|
22
|
+
cpu_cores_min: Optional[int] = None,
|
|
23
|
+
memory_mb_max: Optional[int] = None,
|
|
24
|
+
memory_mb_min: Optional[int] = None,
|
|
25
|
+
storage_class: Optional[str] = None,
|
|
26
|
+
storage_mb_max: Optional[int] = None,
|
|
27
|
+
):
|
|
28
|
+
config = config or {}
|
|
29
|
+
|
|
30
|
+
self.cpu_cores_max = cpu_cores_max
|
|
31
|
+
self.cpu_cores_min = cpu_cores_min
|
|
32
|
+
self.memory_mb_max = memory_mb_max
|
|
33
|
+
self.memory_mb_min = memory_mb_min
|
|
34
|
+
self.storage_class = storage_class
|
|
35
|
+
self.storage_mb_max = storage_mb_max
|
|
36
|
+
|
|
37
|
+
self.__dict__.update(config)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class RuntimeConfig:
|
|
41
|
+
"""
|
|
42
|
+
Runtime configuration class to define the configuration for a pipeline.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __init__(
|
|
46
|
+
self,
|
|
47
|
+
workers: Optional[int] = None,
|
|
48
|
+
storage: Optional[bool] = False,
|
|
49
|
+
tracing: Optional[bool] = False,
|
|
50
|
+
tracing_endpoint_jaeger: Optional[str] = "",
|
|
51
|
+
cpu_profiler: bool = True,
|
|
52
|
+
max_buffering_delay_usecs: int = 0,
|
|
53
|
+
min_batch_size_records: int = 0,
|
|
54
|
+
min_storage_bytes: Optional[int] = None,
|
|
55
|
+
clock_resolution_usecs: Optional[int] = None,
|
|
56
|
+
resources: Optional[Resources] = None,
|
|
57
|
+
):
|
|
58
|
+
self.workers = workers
|
|
59
|
+
self.storage = storage
|
|
60
|
+
self.tracing = tracing
|
|
61
|
+
self.tracing_endpoint_jaeger = tracing_endpoint_jaeger
|
|
62
|
+
self.cpu_profiler = cpu_profiler
|
|
63
|
+
self.max_buffering_delay_usecs = max_buffering_delay_usecs
|
|
64
|
+
self.min_batch_size_records = min_batch_size_records
|
|
65
|
+
self.min_storage_bytes = min_storage_bytes
|
|
66
|
+
self.clock_resolution_usecs = clock_resolution_usecs
|
|
67
|
+
if resources is not None:
|
|
68
|
+
self.resources = resources.__dict__
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def from_dict(cls, d: Mapping[str, Any]):
|
|
72
|
+
"""
|
|
73
|
+
Create a `.RuntimeConfig` object from a dictionary.
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
conf = cls()
|
|
77
|
+
conf.__dict__ = d
|
|
78
|
+
return conf
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: feldera
|
|
3
|
+
Version: 0.34.1
|
|
4
|
+
Summary: The feldera python client
|
|
5
|
+
Author-email: Abhinav <abhinav.gyawali@feldera.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.feldera.com
|
|
8
|
+
Project-URL: Documentation, https://docs.feldera.com/python
|
|
9
|
+
Project-URL: Repository, https://github.com/feldera/feldera
|
|
10
|
+
Project-URL: Issues, https://github.com/feldera/feldera/issues
|
|
11
|
+
Keywords: feldera,python
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
Requires-Dist: requests
|
|
19
|
+
Requires-Dist: pandas
|
|
20
|
+
Requires-Dist: typing-extensions
|
|
21
|
+
Requires-Dist: numpy<2
|
|
22
|
+
Requires-Dist: pretty-errors
|
|
23
|
+
Requires-Dist: ruff>=0.6.9
|
|
24
|
+
|
|
25
|
+
# Feldera Python SDK
|
|
26
|
+
|
|
27
|
+
Feldera Python is the Feldera SDK for Python developers.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install feldera
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Installing from Github
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install git+https://github.com/feldera/feldera#subdirectory=python
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Similarly, to install from a specific branch:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
$ pip install git+https://github.com/feldera/feldera@{BRANCH_NAME}#subdirectory=python
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Replace `{BRANCH_NAME}` with the name of the branch you want to install from.
|
|
48
|
+
|
|
49
|
+
### Installing from Local Directory
|
|
50
|
+
|
|
51
|
+
If you have cloned the Feldera repo, you can install the python SDK as follows:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# the Feldera Python SDK is present inside the python/ directory
|
|
55
|
+
pip install python/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Checkout the docs [here](./feldera/__init__.py) for an example on how to use the SDK.
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
To build the html documentation run:
|
|
63
|
+
|
|
64
|
+
Ensure that you have sphinx installed. If not, install it using `pip install sphinx`.
|
|
65
|
+
|
|
66
|
+
Then run the following commands:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd docs
|
|
70
|
+
sphinx-apidoc -o . ../feldera
|
|
71
|
+
make html
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
To clean the build, run `make clean`.
|
|
75
|
+
|
|
76
|
+
## Testing
|
|
77
|
+
|
|
78
|
+
To run unit tests:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
(cd python && python3 -m unittest)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The following command runs end-to-end tests. You'll need a pipeline
|
|
85
|
+
manager running at `http://localhost:8080`. For the pipeline builder
|
|
86
|
+
tests, you'll also need a broker available at `localhost:9092` and
|
|
87
|
+
(from the pipelines) `redpanda:19092`. (To change those locations,
|
|
88
|
+
set the environment variables listed in `python/tests/__init__.py`.)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
(cd python/tests && python3 -m pytest .)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To run tests from a specific file:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
(cd python/tests && python3 -m unittest ./tests/path-to-file.py)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
To run the aggregate tests use:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
cd python
|
|
104
|
+
PYTHONPATH=`pwd` python3 ./tests/aggregate_tests/main.py
|
|
105
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
feldera/__init__.py,sha256=PxkgCtEAuFwo4u8NGEDio-bF3M-GnbeV45tAQVoBbqE,297
|
|
2
|
+
feldera/_callback_runner.py,sha256=Tdf6BXN4zppyoy8t_y-Ooa3B0wEfvyezMHU9jxY2ZhA,4713
|
|
3
|
+
feldera/_helpers.py,sha256=TuaJPQdAnRV9K5bG7-DCAr45b2JxsZyrwkZBJf1806M,2684
|
|
4
|
+
feldera/enums.py,sha256=tI48tTF65AU5ZLem_IDnC5ycPVMKMv591lW2T__U4C8,7281
|
|
5
|
+
feldera/output_handler.py,sha256=64J3ljhOaKIhxdjOKYi-BUz_HnMwROfmN8eE-btYygU,1930
|
|
6
|
+
feldera/pipeline.py,sha256=yDU5vSRk-2I5P1VeV_Ix5rCDLbjNIkIYEP_gA2vWSIU,29705
|
|
7
|
+
feldera/pipeline_builder.py,sha256=4rmklRZ0-otvTUb-HTESfNsJopEK-E2jxpJXiYlKpps,3664
|
|
8
|
+
feldera/runtime_config.py,sha256=PfYXsrLrs5Duty-7x3dGDf2uvp5hwp3Yb5n3bRQtLVk,2898
|
|
9
|
+
feldera/rest/__init__.py,sha256=Eg-EKUU3RSTDcdxTR_7wNDnCly8VpXEzsZCQUmf-y2M,308
|
|
10
|
+
feldera/rest/_httprequests.py,sha256=y3RxFn4BCTKbUztO1LN2CWXgGA93dIIV5VLdyiWQWuQ,6181
|
|
11
|
+
feldera/rest/config.py,sha256=84Lj2QX6SYNZJdBfrCHPMh29Nj4MY7nRB-uddytx_ok,795
|
|
12
|
+
feldera/rest/errors.py,sha256=b4i2JjrbSmej7jdko_FL8UeXklLKenSipwMT80jowaM,1720
|
|
13
|
+
feldera/rest/feldera_client.py,sha256=kTNN3DaxQ5gnCpTYAggpdlMpBKJJ15bYh_WXI6FzGzU,20570
|
|
14
|
+
feldera/rest/pipeline.py,sha256=o6BFLL3DuurvAhneX1LH7mLjbvX3dn4lCXziYRciUI4,2788
|
|
15
|
+
feldera/rest/sql_table.py,sha256=qrw-YwMzx5T81zDefNO1KOx7EyypFz1vPwGBzSUB7kc,652
|
|
16
|
+
feldera/rest/sql_view.py,sha256=hN12mPM0mvwLCIPYywpb12s9Hd2Ws31IlTMXPriMisw,644
|
|
17
|
+
feldera-0.34.1.dist-info/METADATA,sha256=HQlRtvnIrJqcifk-YaOkjJ_XgCyZBfHFgMlST2xOkrQ,2582
|
|
18
|
+
feldera-0.34.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
19
|
+
feldera-0.34.1.dist-info/top_level.txt,sha256=fB6yTqrQiO6RCbY1xP2T_mpPoTjDFtJvkJJodiee7d0,8
|
|
20
|
+
feldera-0.34.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
feldera
|