feldera 0.172.0__tar.gz → 0.186.0__tar.gz
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.
- feldera-0.186.0/PKG-INFO +163 -0
- feldera-0.186.0/README.md +139 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/__init__.py +2 -2
- {feldera-0.172.0 → feldera-0.186.0}/feldera/pipeline_builder.py +11 -7
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/_helpers.py +1 -1
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/_httprequests.py +365 -232
- feldera-0.186.0/feldera/rest/config.py +44 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/feldera_client.py +59 -33
- {feldera-0.172.0 → feldera-0.186.0}/feldera/testutils.py +1 -10
- feldera-0.186.0/feldera.egg-info/PKG-INFO +163 -0
- {feldera-0.172.0 → feldera-0.186.0}/pyproject.toml +1 -2
- feldera-0.172.0/PKG-INFO +0 -97
- feldera-0.172.0/README.md +0 -73
- feldera-0.172.0/feldera/rest/config.py +0 -51
- feldera-0.172.0/feldera.egg-info/PKG-INFO +0 -97
- {feldera-0.172.0 → feldera-0.186.0}/feldera/_callback_runner.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/_helpers.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/enums.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/output_handler.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/pipeline.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/__init__.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/errors.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/feldera_config.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/pipeline.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/sql_table.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/rest/sql_view.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/runtime_config.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/stats.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/tests/test_datafusionize.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera/testutils_oidc.py +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera.egg-info/SOURCES.txt +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera.egg-info/dependency_links.txt +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera.egg-info/requires.txt +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/feldera.egg-info/top_level.txt +0 -0
- {feldera-0.172.0 → feldera-0.186.0}/setup.cfg +0 -0
feldera-0.186.0/PKG-INFO
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: feldera
|
|
3
|
+
Version: 0.186.0
|
|
4
|
+
Summary: The feldera python client
|
|
5
|
+
Author-email: Feldera Team <dev@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: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: requests
|
|
18
|
+
Requires-Dist: pandas>=2.1.2
|
|
19
|
+
Requires-Dist: typing-extensions
|
|
20
|
+
Requires-Dist: numpy>=2.2.4
|
|
21
|
+
Requires-Dist: pretty-errors
|
|
22
|
+
Requires-Dist: ruff>=0.6.9
|
|
23
|
+
Requires-Dist: PyJWT>=2.8.0
|
|
24
|
+
|
|
25
|
+
# Feldera Python SDK
|
|
26
|
+
|
|
27
|
+
The `feldera` Python package is the Python client for the Feldera HTTP API.
|
|
28
|
+
|
|
29
|
+
The Python SDK documentation is available at: https://docs.feldera.com/python
|
|
30
|
+
|
|
31
|
+
## Getting started
|
|
32
|
+
|
|
33
|
+
### Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
uv pip install feldera
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Example usage
|
|
40
|
+
|
|
41
|
+
The Python client interacts with the API server of the Feldera instance.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
# File: example.py
|
|
45
|
+
from feldera import FelderaClient, PipelineBuilder, Pipeline
|
|
46
|
+
|
|
47
|
+
# Instantiate client
|
|
48
|
+
client = FelderaClient() # Default: http://localhost:8080 without authentication
|
|
49
|
+
# client = FelderaClient(url="https://localhost:8080", api_key="apikey:...", requests_verify="/path/to/tls.crt")
|
|
50
|
+
|
|
51
|
+
# (Re)create pipeline
|
|
52
|
+
name = "example"
|
|
53
|
+
sql = """
|
|
54
|
+
CREATE TABLE t1 (i1 INT) WITH ('materialized' = 'true');
|
|
55
|
+
CREATE MATERIALIZED VIEW v1 AS SELECT * FROM t1;
|
|
56
|
+
"""
|
|
57
|
+
print("(Re)creating pipeline...")
|
|
58
|
+
pipeline = PipelineBuilder(client, name, sql).create_or_replace()
|
|
59
|
+
pipeline.start()
|
|
60
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
61
|
+
pipeline.pause()
|
|
62
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
63
|
+
pipeline.stop(force=True)
|
|
64
|
+
|
|
65
|
+
# Find existing pipeline
|
|
66
|
+
pipeline = Pipeline.get(name, client)
|
|
67
|
+
pipeline.start()
|
|
68
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
69
|
+
pipeline.stop(force=True)
|
|
70
|
+
pipeline.clear_storage()
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Run using:
|
|
74
|
+
```bash
|
|
75
|
+
uv run python example.py
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Environment variables
|
|
79
|
+
|
|
80
|
+
Some default parameter values in the Python SDK can be overridden via environment variables.
|
|
81
|
+
|
|
82
|
+
**Environment variables for `FelderaClient(...)`**
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
export FELDERA_HOST="https://localhost:8080" # Overrides default for `url`
|
|
86
|
+
export FELDERA_API_KEY="apikey:..." # Overrides default for `api_key`
|
|
87
|
+
|
|
88
|
+
# The following together override default for `requests_verify`
|
|
89
|
+
# export FELDERA_TLS_INSECURE="false" # If set to "1", "true" or "yes" (all case-insensitive), disables TLS certificate verification
|
|
90
|
+
# export FELDERA_HTTPS_TLS_CERT="/path/to/tls.crt" # Custom TLS certificate
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Environment variables for `PipelineBuilder(...)`**
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
export FELDERA_RUNTIME_VERSION="..." # Overrides default for `runtime_version`
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Development
|
|
100
|
+
|
|
101
|
+
Development assumes you have cloned the Feldera code repository.
|
|
102
|
+
|
|
103
|
+
### Installation
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cd python
|
|
107
|
+
# Optional: create and activate virtual environment if you don't have one
|
|
108
|
+
uv venv
|
|
109
|
+
source .venv/bin/activate
|
|
110
|
+
# Install in editable mode
|
|
111
|
+
uv pip install -e .
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Formatting
|
|
115
|
+
|
|
116
|
+
Formatting requires the `ruff` package: `uv pip install ruff`
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
cd python
|
|
120
|
+
ruff check
|
|
121
|
+
ruff format
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Tests
|
|
125
|
+
|
|
126
|
+
Running the test requires the `pytest` package: `uv pip install pytest`
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# All tests
|
|
130
|
+
cd python
|
|
131
|
+
uv run python -m pytest tests/
|
|
132
|
+
|
|
133
|
+
# Specific tests directory
|
|
134
|
+
uv run python -m pytest tests/platform/
|
|
135
|
+
|
|
136
|
+
# Specific test file
|
|
137
|
+
uv run python -m pytest tests/platform/test_pipeline_crud.py
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
For further information about the tests, please see `tests/README.md`.
|
|
141
|
+
|
|
142
|
+
### Documentation
|
|
143
|
+
|
|
144
|
+
Building documentation requires the `sphinx` package: `uv pip install sphinx`
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
cd python/docs
|
|
148
|
+
sphinx-apidoc -o . ../feldera
|
|
149
|
+
make html
|
|
150
|
+
make clean # Cleanup afterwards
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Installation from GitHub
|
|
154
|
+
|
|
155
|
+
Latest `main` branch:
|
|
156
|
+
```bash
|
|
157
|
+
uv pip install git+https://github.com/feldera/feldera#subdirectory=python
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Different branch (replace `BRANCH_NAME`):
|
|
161
|
+
```bash
|
|
162
|
+
uv pip install git+https://github.com/feldera/feldera@BRANCH_NAME#subdirectory=python
|
|
163
|
+
```
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Feldera Python SDK
|
|
2
|
+
|
|
3
|
+
The `feldera` Python package is the Python client for the Feldera HTTP API.
|
|
4
|
+
|
|
5
|
+
The Python SDK documentation is available at: https://docs.feldera.com/python
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
### Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv pip install feldera
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Example usage
|
|
16
|
+
|
|
17
|
+
The Python client interacts with the API server of the Feldera instance.
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
# File: example.py
|
|
21
|
+
from feldera import FelderaClient, PipelineBuilder, Pipeline
|
|
22
|
+
|
|
23
|
+
# Instantiate client
|
|
24
|
+
client = FelderaClient() # Default: http://localhost:8080 without authentication
|
|
25
|
+
# client = FelderaClient(url="https://localhost:8080", api_key="apikey:...", requests_verify="/path/to/tls.crt")
|
|
26
|
+
|
|
27
|
+
# (Re)create pipeline
|
|
28
|
+
name = "example"
|
|
29
|
+
sql = """
|
|
30
|
+
CREATE TABLE t1 (i1 INT) WITH ('materialized' = 'true');
|
|
31
|
+
CREATE MATERIALIZED VIEW v1 AS SELECT * FROM t1;
|
|
32
|
+
"""
|
|
33
|
+
print("(Re)creating pipeline...")
|
|
34
|
+
pipeline = PipelineBuilder(client, name, sql).create_or_replace()
|
|
35
|
+
pipeline.start()
|
|
36
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
37
|
+
pipeline.pause()
|
|
38
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
39
|
+
pipeline.stop(force=True)
|
|
40
|
+
|
|
41
|
+
# Find existing pipeline
|
|
42
|
+
pipeline = Pipeline.get(name, client)
|
|
43
|
+
pipeline.start()
|
|
44
|
+
print(f"Pipeline status: {pipeline.status()}")
|
|
45
|
+
pipeline.stop(force=True)
|
|
46
|
+
pipeline.clear_storage()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Run using:
|
|
50
|
+
```bash
|
|
51
|
+
uv run python example.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Environment variables
|
|
55
|
+
|
|
56
|
+
Some default parameter values in the Python SDK can be overridden via environment variables.
|
|
57
|
+
|
|
58
|
+
**Environment variables for `FelderaClient(...)`**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export FELDERA_HOST="https://localhost:8080" # Overrides default for `url`
|
|
62
|
+
export FELDERA_API_KEY="apikey:..." # Overrides default for `api_key`
|
|
63
|
+
|
|
64
|
+
# The following together override default for `requests_verify`
|
|
65
|
+
# export FELDERA_TLS_INSECURE="false" # If set to "1", "true" or "yes" (all case-insensitive), disables TLS certificate verification
|
|
66
|
+
# export FELDERA_HTTPS_TLS_CERT="/path/to/tls.crt" # Custom TLS certificate
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Environment variables for `PipelineBuilder(...)`**
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
export FELDERA_RUNTIME_VERSION="..." # Overrides default for `runtime_version`
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Development
|
|
76
|
+
|
|
77
|
+
Development assumes you have cloned the Feldera code repository.
|
|
78
|
+
|
|
79
|
+
### Installation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cd python
|
|
83
|
+
# Optional: create and activate virtual environment if you don't have one
|
|
84
|
+
uv venv
|
|
85
|
+
source .venv/bin/activate
|
|
86
|
+
# Install in editable mode
|
|
87
|
+
uv pip install -e .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Formatting
|
|
91
|
+
|
|
92
|
+
Formatting requires the `ruff` package: `uv pip install ruff`
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd python
|
|
96
|
+
ruff check
|
|
97
|
+
ruff format
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Tests
|
|
101
|
+
|
|
102
|
+
Running the test requires the `pytest` package: `uv pip install pytest`
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# All tests
|
|
106
|
+
cd python
|
|
107
|
+
uv run python -m pytest tests/
|
|
108
|
+
|
|
109
|
+
# Specific tests directory
|
|
110
|
+
uv run python -m pytest tests/platform/
|
|
111
|
+
|
|
112
|
+
# Specific test file
|
|
113
|
+
uv run python -m pytest tests/platform/test_pipeline_crud.py
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
For further information about the tests, please see `tests/README.md`.
|
|
117
|
+
|
|
118
|
+
### Documentation
|
|
119
|
+
|
|
120
|
+
Building documentation requires the `sphinx` package: `uv pip install sphinx`
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cd python/docs
|
|
124
|
+
sphinx-apidoc -o . ../feldera
|
|
125
|
+
make html
|
|
126
|
+
make clean # Cleanup afterwards
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Installation from GitHub
|
|
130
|
+
|
|
131
|
+
Latest `main` branch:
|
|
132
|
+
```bash
|
|
133
|
+
uv pip install git+https://github.com/feldera/feldera#subdirectory=python
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Different branch (replace `BRANCH_NAME`):
|
|
137
|
+
```bash
|
|
138
|
+
uv pip install git+https://github.com/feldera/feldera@BRANCH_NAME#subdirectory=python
|
|
139
|
+
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from feldera.rest.feldera_client import FelderaClient as FelderaClient
|
|
2
2
|
from feldera.pipeline import Pipeline as Pipeline
|
|
3
3
|
from feldera.pipeline_builder import PipelineBuilder as PipelineBuilder
|
|
4
|
-
from feldera.rest._helpers import
|
|
4
|
+
from feldera.rest._helpers import determine_client_version
|
|
5
5
|
|
|
6
|
-
__version__ =
|
|
6
|
+
__version__ = determine_client_version()
|
|
7
7
|
|
|
8
8
|
import pretty_errors
|
|
9
9
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import os
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
+
from feldera.enums import CompilationProfile, PipelineFieldSelector
|
|
5
|
+
from feldera.pipeline import Pipeline
|
|
6
|
+
from feldera.rest.errors import FelderaAPIError
|
|
4
7
|
from feldera.rest.feldera_client import FelderaClient
|
|
5
8
|
from feldera.rest.pipeline import Pipeline as InnerPipeline
|
|
6
|
-
from feldera.pipeline import Pipeline
|
|
7
|
-
from feldera.enums import CompilationProfile, PipelineFieldSelector
|
|
8
9
|
from feldera.runtime_config import RuntimeConfig
|
|
9
|
-
from feldera.rest.errors import FelderaAPIError
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class PipelineBuilder:
|
|
@@ -49,10 +49,11 @@ class PipelineBuilder:
|
|
|
49
49
|
"FELDERA_RUNTIME_VERSION", runtime_version
|
|
50
50
|
)
|
|
51
51
|
|
|
52
|
-
def create(self) -> Pipeline:
|
|
52
|
+
def create(self, wait: bool = True) -> Pipeline:
|
|
53
53
|
"""
|
|
54
54
|
Create the pipeline if it does not exist.
|
|
55
55
|
|
|
56
|
+
:param wait: Whether to wait for the pipeline to be created. True by default
|
|
56
57
|
:return: The created pipeline
|
|
57
58
|
"""
|
|
58
59
|
|
|
@@ -82,17 +83,20 @@ class PipelineBuilder:
|
|
|
82
83
|
runtime_config=self.runtime_config.to_dict(),
|
|
83
84
|
)
|
|
84
85
|
|
|
85
|
-
inner = self.client.create_pipeline(inner)
|
|
86
|
+
inner = self.client.create_pipeline(inner, wait=wait)
|
|
86
87
|
pipeline = Pipeline(self.client)
|
|
87
88
|
pipeline._inner = inner
|
|
88
89
|
|
|
89
90
|
return pipeline
|
|
90
91
|
|
|
91
|
-
def create_or_replace(self) -> Pipeline:
|
|
92
|
+
def create_or_replace(self, wait: bool = True) -> Pipeline:
|
|
92
93
|
"""
|
|
93
94
|
Creates a pipeline if it does not exist and replaces it if it exists.
|
|
94
95
|
|
|
95
96
|
If the pipeline exists and is running, it will be stopped and replaced.
|
|
97
|
+
|
|
98
|
+
:param wait: Whether to wait for the pipeline to be created. True by default
|
|
99
|
+
:return: The created pipeline
|
|
96
100
|
"""
|
|
97
101
|
|
|
98
102
|
if self.name is None or self.sql is None:
|
|
@@ -121,7 +125,7 @@ class PipelineBuilder:
|
|
|
121
125
|
runtime_config=self.runtime_config.to_dict(),
|
|
122
126
|
)
|
|
123
127
|
|
|
124
|
-
inner = self.client.create_or_update_pipeline(inner)
|
|
128
|
+
inner = self.client.create_or_update_pipeline(inner, wait=wait)
|
|
125
129
|
pipeline = Pipeline(self.client)
|
|
126
130
|
pipeline._inner = inner
|
|
127
131
|
|