feldera 0.100.0__py3-none-any.whl → 0.101.0__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.

@@ -54,12 +54,12 @@ class CallbackRunner(Thread):
54
54
  )
55
55
 
56
56
  # by default, we assume that the pipeline has been started
57
- ack: _CallbackRunnerInstruction = _CallbackRunnerInstruction.PipelineStarted
57
+ ack = _CallbackRunnerInstruction.PipelineStarted
58
58
 
59
59
  # if there is Queue, we wait for the instruction to start the pipeline
60
60
  # this means that we are listening to the pipeline before running it, therefore, all data should be received
61
61
  if self.queue:
62
- ack: _CallbackRunnerInstruction = self.queue.get()
62
+ ack = self.queue.get()
63
63
 
64
64
  match ack:
65
65
  # if the pipeline has actually been started, we start a listener
@@ -77,11 +77,12 @@ class CallbackRunner(Thread):
77
77
 
78
78
  for chunk in gen_obj:
79
79
  chunk: dict = chunk
80
- data: list[dict] = chunk.get("json_data")
81
- seq_no: int = chunk.get("sequence_number")
82
-
83
- if data is not None:
84
- self.callback(dataframe_from_response([data], schema), seq_no)
80
+ data: Optional[list[dict]] = chunk.get("json_data")
81
+ seq_no: Optional[int] = chunk.get("sequence_number")
82
+ if data is not None and seq_no is not None:
83
+ self.callback(
84
+ dataframe_from_response([data], self.schema), seq_no
85
+ )
85
86
 
86
87
  if self.queue:
87
88
  try:
feldera/pipeline.py CHANGED
@@ -473,10 +473,13 @@ metrics"""
473
473
  pipeline to stop.
474
474
  """
475
475
 
476
- if len(self.views_tx) > 0:
477
- for _, queue in self.views_tx.pop().items():
476
+ for view_queue in self.views_tx:
477
+ for _, queue in view_queue.items():
478
478
  # sends a message to the callback runner to stop listening
479
479
  queue.put(_CallbackRunnerInstruction.RanToCompletion)
480
+
481
+ if len(self.views_tx) > 0:
482
+ for view_name, queue in self.views_tx.pop().items():
480
483
  # block until the callback runner has been stopped
481
484
  queue.join()
482
485
 
@@ -2,7 +2,7 @@ from feldera.rest.feldera_client import FelderaClient
2
2
  from feldera.rest.pipeline import Pipeline as InnerPipeline
3
3
  from feldera.pipeline import Pipeline
4
4
  from feldera.enums import CompilationProfile
5
- from feldera.runtime_config import RuntimeConfig, Resources
5
+ from feldera.runtime_config import RuntimeConfig
6
6
  from feldera.rest.errors import FelderaAPIError
7
7
 
8
8
 
@@ -29,7 +29,7 @@ class PipelineBuilder:
29
29
  udf_toml: str = "",
30
30
  description: str = "",
31
31
  compilation_profile: CompilationProfile = CompilationProfile.OPTIMIZED,
32
- runtime_config: RuntimeConfig = RuntimeConfig(resources=Resources()),
32
+ runtime_config: RuntimeConfig = RuntimeConfig.default(),
33
33
  ):
34
34
  self.client: FelderaClient = client
35
35
  self.name: str | None = name
@@ -454,11 +454,11 @@ Reason: The pipeline is in a STOPPED state due to the following error:
454
454
  pipeline_name: str,
455
455
  table_name: str,
456
456
  format: str,
457
- data: list[list | str | dict] | dict,
457
+ data: list[list | str | dict] | dict | str,
458
458
  array: bool = False,
459
459
  force: bool = False,
460
460
  update_format: str = "raw",
461
- json_flavor: str = None,
461
+ json_flavor: Optional[str] = None,
462
462
  serialize: bool = True,
463
463
  ):
464
464
  """
feldera/runtime_config.py CHANGED
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from typing import Optional, Any, Mapping
2
3
 
3
4
 
@@ -72,6 +73,7 @@ class RuntimeConfig:
72
73
  clock_resolution_usecs: Optional[int] = None,
73
74
  provisioning_timeout_secs: Optional[int] = None,
74
75
  resources: Optional[Resources] = None,
76
+ runtime_version: Optional[str] = None,
75
77
  ):
76
78
  self.workers = workers
77
79
  self.tracing = tracing
@@ -81,6 +83,9 @@ class RuntimeConfig:
81
83
  self.min_batch_size_records = min_batch_size_records
82
84
  self.clock_resolution_usecs = clock_resolution_usecs
83
85
  self.provisioning_timeout_secs = provisioning_timeout_secs
86
+ self.runtime_version = runtime_version or os.environ.get(
87
+ "FELDERA_RUNTIME_VERSION"
88
+ )
84
89
  if resources is not None:
85
90
  self.resources = resources.__dict__
86
91
  if isinstance(storage, bool):
@@ -88,6 +93,10 @@ class RuntimeConfig:
88
93
  if isinstance(storage, Storage):
89
94
  self.storage = storage.__dict__
90
95
 
96
+ @staticmethod
97
+ def default() -> "RuntimeConfig":
98
+ return RuntimeConfig(resources=Resources())
99
+
91
100
  @classmethod
92
101
  def from_dict(cls, d: Mapping[str, Any]):
93
102
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: feldera
3
- Version: 0.100.0
3
+ Version: 0.101.0
4
4
  Summary: The feldera python client
5
5
  Author-email: Feldera Team <dev@feldera.com>
6
6
  License: MIT
@@ -54,10 +54,11 @@ If you have cloned the Feldera repo, you can install the python SDK as follows:
54
54
  pip install python/
55
55
  ```
56
56
 
57
- Checkout the docs [here](./feldera/__init__.py) for an example on how to use the SDK.
58
-
59
57
  ## Documentation
60
58
 
59
+ The Python SDK documentation is available at
60
+ [Feldera Python SDK Docs](https://docs.feldera.com/python).
61
+
61
62
  To build the html documentation run:
62
63
 
63
64
  Ensure that you have sphinx installed. If not, install it using `pip install sphinx`.
@@ -77,27 +78,23 @@ To clean the build, run `make clean`.
77
78
  To run unit tests:
78
79
 
79
80
  ```bash
80
- (cd python && python3 -m unittest)
81
+ cd python && python3 -m pytest tests/
81
82
  ```
82
83
 
83
- > ⚠️ Running the unit tests will **delete all existing pipelines**.
84
-
85
- The following command runs end-to-end tests. You'll need a pipeline
86
- manager running at `http://localhost:8080`. For the pipeline builder
87
- tests, you'll also need a broker available at `localhost:9092` and
88
- (from the pipelines) `redpanda:19092`. (To change those locations,
89
- set the environment variables listed in `python/tests/__init__.py`.)
90
-
91
- ```bash
92
- (cd python && python3 -m pytest tests)
93
- ```
84
+ - This will detect and run all test files that match the pattern `test_*.py` or
85
+ `*_test.py`.
86
+ - By default, the tests expect a running Feldera instance at `http://localhost:8080`.
87
+ To override the default endpoint, set the `FELDERA_BASE_URL` environment variable.
94
88
 
95
89
  To run tests from a specific file:
96
90
 
97
91
  ```bash
98
- (cd python && python3 -m unittest ./tests/path-to-file.py)
92
+ (cd python && python3 -m pytest ./tests/path-to-file.py)
99
93
  ```
100
94
 
95
+ #### Running Aggregate Tests
96
+
97
+ The aggregate tests validate end-to-end correctness of SQL functionality.
101
98
  To run the aggregate tests use:
102
99
 
103
100
  ```bash
@@ -105,6 +102,38 @@ cd python
105
102
  PYTHONPATH=`pwd` python3 ./tests/aggregate_tests/main.py
106
103
  ```
107
104
 
105
+ ### Reducing Compilation Cycles
106
+
107
+ To reduce redundant compilation cycles during testing:
108
+
109
+ * **Inherit from `SharedTestPipeline`** instead of `unittest.TestCase`.
110
+ * **Define DDLs** (e.g., `CREATE TABLE`, `CREATE VIEW`) in the **docstring** of each test method.
111
+ * All DDLs from all test functions in the class are combined and compiled into a single pipeline.
112
+ * If a table or view is already defined in one test, it can be used directly in others without redefinition.
113
+ * Ensure that all table and view names are unique within the class.
114
+ * Use `@enterprise_only` on tests that require Enterprise features. Their DDLs will be skipped on OSS builds.
115
+ * Use `self.set_runtime_config(...)` to override the default pipeline config.
116
+ * Reset it at the end using `self.reset_runtime_config()`.
117
+ * Access the shared pipeline via `self.pipeline`.
118
+
119
+ #### Example
120
+
121
+ ```python
122
+ from tests.shared_test_pipeline import SharedTestPipeline
123
+
124
+ class TestAverage(SharedTestPipeline):
125
+ def test_average(self):
126
+ """
127
+ CREATE TABLE students(id INT, name STRING);
128
+ CREATE MATERIALIZED VIEW v AS SELECT * FROM students;
129
+ """
130
+ ...
131
+ self.pipeline.start()
132
+ self.pipeline.input_pandas("students", df)
133
+ self.pipeline.wait_for_completion(True)
134
+ ...
135
+ ```
136
+
108
137
  ## Linting and formatting
109
138
 
110
139
  Use [Ruff] to run the lint checks that will be executed by the
@@ -1,23 +1,23 @@
1
1
  feldera/__init__.py,sha256=EiY3bTj_mnfNhCGrZo6J__brfovIJ-YYAdy77PyaEoo,378
2
- feldera/_callback_runner.py,sha256=Tdf6BXN4zppyoy8t_y-Ooa3B0wEfvyezMHU9jxY2ZhA,4713
2
+ feldera/_callback_runner.py,sha256=GNOg3TrKJg9zJU0HvpWxCHqzjMUX8ORiHhtiEEdVQzE,4758
3
3
  feldera/_helpers.py,sha256=rN0WuGSCCQlXWFMimZUQrgs-LJAfUo074d79sLElncQ,3023
4
4
  feldera/enums.py,sha256=AWx7wldY2vBbrJMAwFabGQ8C_ZTKZreiqRvuGlrC9Ks,8702
5
5
  feldera/output_handler.py,sha256=64J3ljhOaKIhxdjOKYi-BUz_HnMwROfmN8eE-btYygU,1930
6
- feldera/pipeline.py,sha256=5-OP_ugda-_BKhB3232JEHrzkO-FFuZtjVjLJ3yJ2Bg,34309
7
- feldera/pipeline_builder.py,sha256=xOIQhkTJ_E9gMCLI-4_xcGwbUdoq-aT9UK_khj0eiog,3948
8
- feldera/runtime_config.py,sha256=EDvnakyaRTHUS8GLd6TqLZ_jsGp7_4fbcPnSfQCw1k0,3501
6
+ feldera/pipeline.py,sha256=Wc9yfnEXkVQ_WQSYuENisN6VSzANVJbsSuQGt1K0E_k,34407
7
+ feldera/pipeline_builder.py,sha256=rImmAkYgpCGxZyH317mUMvChLuGF0rH8gvEOVcTYN4M,3924
8
+ feldera/runtime_config.py,sha256=jeVuv2B6H0IDSmkyQgsuSOv1B656jvJIL9re4Sv4Rjw,3781
9
9
  feldera/stats.py,sha256=XBhkRsV7FXErwWuPP0i3q9W77mzkMo-oThPVEZy5y3U,5028
10
10
  feldera/rest/__init__.py,sha256=Eg-EKUU3RSTDcdxTR_7wNDnCly8VpXEzsZCQUmf-y2M,308
11
11
  feldera/rest/_helpers.py,sha256=q7jWInKp9IiIli8N5o31lDG3hNUbcsJqufZXYHG04ps,222
12
12
  feldera/rest/_httprequests.py,sha256=e22YbpzOzy7MGo7hk9MOU7ZRTj3F314grY0Ygr-_goI,6636
13
13
  feldera/rest/config.py,sha256=DYzZKngDEhouTEwqVFd-rDrBN9tWqsU07Jl_BTT4mXs,1008
14
14
  feldera/rest/errors.py,sha256=b4i2JjrbSmej7jdko_FL8UeXklLKenSipwMT80jowaM,1720
15
- feldera/rest/feldera_client.py,sha256=xWmoHUm-epaDZP64Wgc4PXCWSPwfSXoZrIF_93WIYok,25273
15
+ feldera/rest/feldera_client.py,sha256=E0_cqpIaavVeapBLc5egZIl5KVsKWliDzWqXk6_r0nY,25289
16
16
  feldera/rest/feldera_config.py,sha256=1pnGbLFMSLvp7Qh_OlPLALSKCSHIktNWKvx6gYU00U4,1374
17
17
  feldera/rest/pipeline.py,sha256=-dGGUdtHMABKrQEclaeuwGI_FOCrQOk6p2aCFV0FdU8,2890
18
18
  feldera/rest/sql_table.py,sha256=qrw-YwMzx5T81zDefNO1KOx7EyypFz1vPwGBzSUB7kc,652
19
19
  feldera/rest/sql_view.py,sha256=hN12mPM0mvwLCIPYywpb12s9Hd2Ws31IlTMXPriMisw,644
20
- feldera-0.100.0.dist-info/METADATA,sha256=FXjoSJakdfYI6Um1ZdZJnM8mfzjXiee4nYn5Gd8Rzjc,2893
21
- feldera-0.100.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- feldera-0.100.0.dist-info/top_level.txt,sha256=fB6yTqrQiO6RCbY1xP2T_mpPoTjDFtJvkJJodiee7d0,8
23
- feldera-0.100.0.dist-info/RECORD,,
20
+ feldera-0.101.0.dist-info/METADATA,sha256=6H0v0BPG56ovszTNICNFycsdWM26sDt3Mdsyp4dQ3_4,4101
21
+ feldera-0.101.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ feldera-0.101.0.dist-info/top_level.txt,sha256=fB6yTqrQiO6RCbY1xP2T_mpPoTjDFtJvkJJodiee7d0,8
23
+ feldera-0.101.0.dist-info/RECORD,,