You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by bo...@apache.org on 2023/03/11 13:12:45 UTC

[streampipes] branch rel/0.91.0 updated (90701600c -> c0c97b0e7)

This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a change to branch rel/0.91.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git


    from 90701600c [#1375] add versioning to python docs (#1397)
     new e40d5ada5 Update data stream generator (#1258) (#1286)
     new 4714036b6 Add support for the Kafka broker in Python (#1363)
     new c0c97b0e7 docs: add matomo tracking to python docs (#1409)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../analytics/matomo.html}                         |  47 ++++-----
 streampipes-client-python/mkdocs.yml               |   2 +
 streampipes-client-python/setup.py                 |   1 +
 .../streampipes/function_zoo/river_function.py     |   2 +-
 .../streampipes/functions/broker/__init__.py       |   2 +
 .../streampipes/functions/broker/broker_handler.py |   5 +-
 .../broker/{nats_broker.py => kafka_broker.py}     |  25 +++--
 .../functions/broker/kafka_message_fetcher.py      |  43 ++++----
 .../functions/utils/data_stream_generator.py       | 114 +++++----------------
 .../streampipes/model/common.py                    |  52 +++++++---
 .../model/resource/data_lake_measure.py            |   2 +-
 .../streampipes/model/resource/data_stream.py      |  36 ++++---
 12 files changed, 149 insertions(+), 182 deletions(-)
 copy streampipes-client-python/docs/overrides/partials/{footer.html => integrations/analytics/matomo.html} (50%)
 copy streampipes-client-python/streampipes/functions/broker/{nats_broker.py => kafka_broker.py} (78%)
 copy streampipes-extensions/streampipes-connect-adapters/src/main/resources/org.apache.streampipes.connect.adapters.ti/strings.en => streampipes-client-python/streampipes/functions/broker/kafka_message_fetcher.py (54%)


[streampipes] 01/03: Update data stream generator (#1258) (#1286)

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch rel/0.91.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit e40d5ada5ebf64fdd488b1e1c9f5271e9e865519
Author: Sven Oehler <43...@users.noreply.github.com>
AuthorDate: Mon Feb 20 09:58:36 2023 +0100

    Update data stream generator (#1258) (#1286)
    
    * Update data stream generator
    
    * Fix data stream name
    
    * Update default values
---
 .../streampipes/function_zoo/river_function.py     |   2 +-
 .../functions/utils/data_stream_generator.py       | 114 +++++----------------
 .../streampipes/model/common.py                    |  52 +++++++---
 .../streampipes/model/resource/data_stream.py      |  36 ++++---
 4 files changed, 82 insertions(+), 122 deletions(-)

diff --git a/streampipes-client-python/streampipes/function_zoo/river_function.py b/streampipes-client-python/streampipes/function_zoo/river_function.py
index 2b73b3ceb..ac142c989 100644
--- a/streampipes-client-python/streampipes/function_zoo/river_function.py
+++ b/streampipes-client-python/streampipes/function_zoo/river_function.py
@@ -151,7 +151,7 @@ class OnlineML:
     ):
         self.client = client
 
-        attributes = {"learning": "boolean", "prediction": prediction_type}
+        attributes = {"learning": RuntimeType.BOOLEAN.value, "prediction": prediction_type}
         if supervised:
             attributes["truth"] = prediction_type
             if target_label is None:
diff --git a/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py b/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
index 86bf8cdb5..e11657e44 100644
--- a/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
+++ b/streampipes-client-python/streampipes/functions/utils/data_stream_generator.py
@@ -15,26 +15,13 @@
 # limitations under the License.
 #
 
-import random
-import string
 from enum import Enum
 from typing import Dict, Optional
-from uuid import uuid4
 
+from streampipes.model.common import EventProperty, EventSchema
 from streampipes.model.resource.data_stream import DataStream
 
 
-def random_letters(n: int):
-    """Generates n random letters.
-
-    Parameters
-    ----------
-    n: int
-        number of letters
-    """
-    return "".join(random.choice(string.ascii_letters) for _ in range(n))
-
-
 class RuntimeType(Enum):
     """Runtime types for the attributes of a data stream."""
 
@@ -59,79 +46,28 @@ def create_data_stream(name: str, attributes: Dict[str, str], stream_id: Optiona
     stream_id: str
         The id of this data stream.
     """
-    if not stream_id:
-        stream_id = f"sp:spdatastream:{random_letters(6)}"
-    return DataStream(
-        **{
-            "@class": "org.apache.streampipes.model.SpDataStream",
-            "elementId": stream_id,
-            "dom": None,
-            "connectedTo": None,
-            "name": name,
-            "description": "",
-            "iconUrl": None,
-            "appId": None,
-            "includesAssets": False,
-            "includesLocales": False,
-            "includedAssets": [],
-            "includedLocales": [],
-            "internallyManaged": False,
-            "eventGrounding": {
-                "transportProtocols": [
-                    {
-                        "@class": "org.apache.streampipes.model.grounding.NatsTransportProtocol",
-                        "elementId": f"sp:transportprotocol:{random_letters(6)}",
-                        "brokerHostname": "nats",
-                        "topicDefinition": {
-                            "@class": "org.apache.streampipes.model.grounding.SimpleTopicDefinition",
-                            "actualTopicName": f"org.apache.streampipes.connect.{uuid4()}",
-                        },
-                        "port": 4222,
-                    }
-                ],
-                "transportFormats": [{"rdfType": ["http://sepa.event-processing.org/sepa#json"]}],
-            },
-            "eventSchema": {
-                "eventProperties": [
-                    {
-                        "@class": "org.apache.streampipes.model.schema.EventPropertyPrimitive",
-                        "elementId": f"sp:eventproperty:{random_letters(6)}",
-                        "label": "timestamp",
-                        "description": None,
-                        "runtimeName": "timestamp",
-                        "required": False,
-                        "domainProperties": ["http://schema.org/DateTime"],
-                        "propertyScope": "HEADER_PROPERTY",
-                        "index": 0,
-                        "runtimeId": None,
-                        "runtimeType": "http://www.w3.org/2001/XMLSchema#long",
-                        "measurementUnit": None,
-                        "valueSpecification": None,
-                    }
-                ]
-                + [
-                    {
-                        "@class": "org.apache.streampipes.model.schema.EventPropertyPrimitive",
-                        "elementId": f"sp:eventproperty:{random_letters(6)}",
-                        "label": attribute_name,
-                        "description": None,
-                        "runtimeName": attribute_name,
-                        "required": False,
-                        "domainProperties": [],
-                        "propertyScope": "MEASUREMENT_PROPERTY",
-                        "index": i,
-                        "runtimeId": None,
-                        "runtimeType": f"http://www.w3.org/2001/XMLSchema#{attribute_type}",
-                        "measurementUnit": None,
-                        "valueSpecification": None,
-                    }
-                    for i, (attribute_name, attribute_type) in enumerate(attributes.items(), start=1)
-                ]
-            },
-            "category": None,
-            "index": 0,
-            "correspondingAdapterId": None,
-            "uri": stream_id,
-            "_rev": None,
-        }
+
+    event_schema = EventSchema(
+        event_properties=[
+            EventProperty(
+                label="timestamp",
+                runtime_name="timestamp",
+                domain_properties=["http://schema.org/DateTime"],
+                property_scope="HEADER_PROPERTY",
+                runtime_type="http://www.w3.org/2001/XMLSchema#long",
+            )
+        ]
+        + [
+            EventProperty(
+                label=attribute_name,
+                runtime_name=attribute_name,
+                index=i,
+                runtime_type=f"http://www.w3.org/2001/XMLSchema#{attribute_type}",
+            )
+            for i, (attribute_name, attribute_type) in enumerate(attributes.items(), start=1)
+        ]
     )
+
+    if not stream_id:
+        return DataStream(name=name, event_schema=event_schema)
+    return DataStream(element_id=stream_id, name=name, event_schema=event_schema)
diff --git a/streampipes-client-python/streampipes/model/common.py b/streampipes-client-python/streampipes/model/common.py
index fb7bcd797..edc24b955 100644
--- a/streampipes-client-python/streampipes/model/common.py
+++ b/streampipes-client-python/streampipes/model/common.py
@@ -19,7 +19,10 @@
 Classes of the StreamPipes data model that are commonly shared.
 """
 
+import random
+import string
 from typing import List, Optional
+from uuid import uuid4
 
 from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr
 
@@ -30,6 +33,17 @@ __all__ = [
 ]
 
 
+def random_letters(n: int):
+    """Generates n random letters.
+
+    Parameters
+    ----------
+    n: int
+        number of letters
+    """
+    return "".join(random.choice(string.ascii_letters) for _ in range(n))
+
+
 def _snake_to_camel_case(snake_case_string: str) -> str:
     """Converts a string in snake_case format to camelCase style."""
 
@@ -73,17 +87,17 @@ class EventProperty(BasicModel):
     Data model of an `EventProperty` in compliance to the StreamPipes Backend.
     """
 
-    class_name: Optional[StrictStr] = Field(alias="@class")
-    element_id: Optional[StrictStr]
+    class_name: StrictStr = Field(alias="@class", default="org.apache.streampipes.model.schema.EventPropertyPrimitive")
+    element_id: StrictStr = Field(default_factory=lambda: f"sp:eventproperty:{random_letters(6)}")
     label: Optional[StrictStr]
     description: Optional[StrictStr]
     runtime_name: StrictStr
-    required: StrictBool
-    domain_properties: List[StrictStr]
-    property_scope: Optional[StrictStr]
-    index: StrictInt
+    required: StrictBool = Field(default=False)
+    domain_properties: List[StrictStr] = Field(default_factory=list)
+    property_scope: StrictStr = Field(default="MEASUREMENT_PROPERTY")
+    index: StrictInt = Field(default=0)
     runtime_id: Optional[StrictStr]
-    runtime_type: Optional[StrictStr]
+    runtime_type: StrictStr = Field(default="http://www.w3.org/2001/XMLSchema#string")
     measurement_unit: Optional[StrictStr]
     value_specification: Optional[ValueSpecification]
 
@@ -115,8 +129,10 @@ class TopicDefinition(BasicModel):
     Data model of a `TopicDefinition` in compliance to the StreamPipes Backend.
     """
 
-    class_name: Optional[StrictStr] = Field(alias="@class")
-    actual_topic_name: StrictStr
+    class_name: Optional[StrictStr] = Field(
+        alias="@class", default="org.apache.streampipes.model.grounding.SimpleTopicDefinition"
+    )
+    actual_topic_name: StrictStr = Field(default_factory=lambda: f"org.apache.streampipes.connect.{uuid4()}")
 
 
 class TransportProtocol(BasicModel):
@@ -124,11 +140,13 @@ class TransportProtocol(BasicModel):
     Data model of a `TransportProtocol` in compliance to the StreamPipes Backend.
     """
 
-    class_name: StrictStr = Field(alias="@class")
-    element_id: Optional[StrictStr]
-    broker_hostname: StrictStr
-    topic_definition: TopicDefinition
-    port: StrictInt = Field(alias="kafkaPort")
+    class_name: StrictStr = Field(
+        alias="@class", default="org.apache.streampipes.model.grounding.NatsTransportProtocol"
+    )
+    element_id: StrictStr = Field(default_factory=lambda: f"sp:transportprotocol:{random_letters(6)}")
+    broker_hostname: StrictStr = Field(default="nats")
+    topic_definition: TopicDefinition = Field(default_factory=TopicDefinition)
+    port: StrictInt = Field(alias="kafkaPort", default=4222)
 
 
 class TransportFormat(BasicModel):
@@ -136,7 +154,7 @@ class TransportFormat(BasicModel):
     Data model of a `TransportFormat` in compliance to the StreamPipes Backend.
     """
 
-    rdf_type: Optional[List[Optional[StrictStr]]]
+    rdf_type: List[StrictStr] = Field(default=["http://sepa.event-processing.org/sepa#json"])
 
 
 class EventGrounding(BasicModel):
@@ -144,8 +162,8 @@ class EventGrounding(BasicModel):
     Data model of an `EventGrounding` in compliance to the StreamPipes Backend.
     """
 
-    transport_protocols: List[TransportProtocol]
-    transport_formats: Optional[List[Optional[TransportFormat]]]
+    transport_protocols: List[TransportProtocol] = Field(default_factory=lambda: [TransportProtocol()])
+    transport_formats: List[TransportFormat] = Field(default_factory=lambda: [TransportFormat()])
 
 
 class MeasurementCapability(BasicModel):
diff --git a/streampipes-client-python/streampipes/model/resource/data_stream.py b/streampipes-client-python/streampipes/model/resource/data_stream.py
index 97d049b2d..d053eb574 100644
--- a/streampipes-client-python/streampipes/model/resource/data_stream.py
+++ b/streampipes-client-python/streampipes/model/resource/data_stream.py
@@ -23,6 +23,7 @@ from streampipes.model.common import (
     EventSchema,
     MeasurementCapability,
     MeasurementObject,
+    random_letters,
 )
 from streampipes.model.resource.resource import Resource
 
@@ -72,26 +73,31 @@ class DataStream(Resource):
             "num_included_locales": len(self.included_locales) if self.included_locales is not None else 0,
         }
 
-    class_name: Optional[StrictStr] = Field(alias="@class")
-    element_id: StrictStr
-    name: Optional[StrictStr]
+    def __init__(self, **kwargs):
+        super().__init__(**kwargs)
+        if not self.uri:
+            self.uri = self.element_id
+
+    class_name: StrictStr = Field(alias="@class", default_factory=lambda: "org.apache.streampipes.model.SpDataStream")
+    element_id: StrictStr = Field(default_factory=lambda: f"sp:spdatastream:{random_letters(6)}")
+    name: StrictStr = Field(default="Unnamed")
     description: Optional[StrictStr]
     icon_url: Optional[StrictStr]
     app_id: Optional[StrictStr]
-    includes_assets: Optional[StrictBool]
-    includes_locales: Optional[StrictBool]
-    included_assets: Optional[List[Optional[StrictStr]]]
-    included_locales: Optional[List[Optional[StrictStr]]]
-    application_links: Optional[List[Optional[ApplicationLink]]]
-    internally_managed: Optional[StrictBool]
-    connected_to: Optional[List[Optional[StrictStr]]]
-    event_grounding: EventGrounding
+    includes_assets: StrictBool = Field(default=False)
+    includes_locales: StrictBool = Field(default=False)
+    included_assets: List[StrictStr] = Field(default_factory=list)
+    included_locales: List[StrictStr] = Field(default_factory=list)
+    application_links: List[ApplicationLink] = Field(default_factory=list)
+    internally_managed: StrictBool = Field(default=False)
+    connected_to: Optional[List[StrictStr]]
+    event_grounding: EventGrounding = Field(default_factory=EventGrounding)
     event_schema: Optional[EventSchema]
-    measurement_capability: Optional[List[Optional[MeasurementCapability]]]
-    measurement_object: Optional[List[Optional[MeasurementObject]]]
-    index: Optional[StrictInt]
+    measurement_capability: Optional[List[MeasurementCapability]]
+    measurement_object: Optional[List[MeasurementObject]]
+    index: StrictInt = Field(default=0)
     corresponding_adapter_id: Optional[StrictStr]
-    category: Optional[List[Optional[StrictStr]]]
+    category: Optional[List[StrictStr]]
     uri: Optional[StrictStr]
     dom: Optional[StrictStr]
     rev: Optional[StrictStr] = Field(alias="_rev")


[streampipes] 02/03: Add support for the Kafka broker in Python (#1363)

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch rel/0.91.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 4714036b6966fe5160ed8b3cb3b83bfeeb489355
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sat Mar 11 13:59:14 2023 +0100

    Add support for the Kafka broker in Python (#1363)
    
    * Update data model
    
    * Support Kafka as messaging protocol in Python client (#1362)
    
    * Reformat code (#1362)
    
    * Update broker __init__
    
    ---------
    
    Co-authored-by: Sven Oehler <oe...@web.de>
    Co-authored-by: Sven Oehler <43...@users.noreply.github.com>
---
 streampipes-client-python/setup.py                 |  1 +
 .../streampipes/functions/broker/__init__.py       |  2 +
 .../streampipes/functions/broker/broker_handler.py |  5 +-
 .../streampipes/functions/broker/kafka_broker.py   | 96 ++++++++++++++++++++++
 .../{__init__.py => kafka_message_fetcher.py}      | 41 +++++++--
 .../streampipes/model/common.py                    |  4 +-
 .../model/resource/data_lake_measure.py            |  2 +-
 7 files changed, 138 insertions(+), 13 deletions(-)

diff --git a/streampipes-client-python/setup.py b/streampipes-client-python/setup.py
index 5463bcd11..e7ab475ed 100644
--- a/streampipes-client-python/setup.py
+++ b/streampipes-client-python/setup.py
@@ -35,6 +35,7 @@ base_packages = [
     "pydantic>=1.10.2",
     "requests>=2.28.1",
     "nats-py>=2.2.0",
+    "confluent-kafka>=2.0.2"
 ]
 
 dev_packages = base_packages + [
diff --git a/streampipes-client-python/streampipes/functions/broker/__init__.py b/streampipes-client-python/streampipes/functions/broker/__init__.py
index 45ffbdc7c..32d35fba3 100644
--- a/streampipes-client-python/streampipes/functions/broker/__init__.py
+++ b/streampipes-client-python/streampipes/functions/broker/__init__.py
@@ -15,12 +15,14 @@
 # limitations under the License.
 #
 from .broker import Broker
+from .kafka_broker import KafkaBroker
 from .nats_broker import NatsBroker
 
 from .broker_handler import SupportedBroker, get_broker  # isort: skip
 
 __all__ = [
     "Broker",
+    "KafkaBroker",
     "NatsBroker",
     "SupportedBroker",
     "get_broker",
diff --git a/streampipes-client-python/streampipes/functions/broker/broker_handler.py b/streampipes-client-python/streampipes/functions/broker/broker_handler.py
index 2c05b839d..3aac0f986 100644
--- a/streampipes-client-python/streampipes/functions/broker/broker_handler.py
+++ b/streampipes-client-python/streampipes/functions/broker/broker_handler.py
@@ -16,7 +16,7 @@
 #
 from enum import Enum
 
-from streampipes.functions.broker import Broker, NatsBroker
+from streampipes.functions.broker import Broker, KafkaBroker, NatsBroker
 from streampipes.model.resource.data_stream import DataStream
 
 
@@ -24,6 +24,7 @@ class SupportedBroker(Enum):
     """Enum for the supported brokers."""
 
     NATS = "NatsTransportProtocol"
+    KAFKA = "KafkaTransportProtocol"
 
 
 # TODO Exception should be removed once all brokers are implemented.
@@ -49,5 +50,7 @@ def get_broker(data_stream: DataStream) -> Broker:  # TODO implementation for mo
     broker_name = data_stream.event_grounding.transport_protocols[0].class_name
     if SupportedBroker.NATS.value in broker_name:
         return NatsBroker()
+    elif SupportedBroker.KAFKA.value in broker_name:
+        return KafkaBroker()
     else:
         raise UnsupportedBroker(f'The python client doesn\'t include the broker: "{broker_name}" yet')
diff --git a/streampipes-client-python/streampipes/functions/broker/kafka_broker.py b/streampipes-client-python/streampipes/functions/broker/kafka_broker.py
new file mode 100644
index 000000000..900d7f6c1
--- /dev/null
+++ b/streampipes-client-python/streampipes/functions/broker/kafka_broker.py
@@ -0,0 +1,96 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import logging
+from typing import Any, AsyncIterator, Dict
+
+from confluent_kafka import Consumer  # type: ignore
+from streampipes.functions.broker.broker import Broker
+from streampipes.functions.broker.kafka_message_fetcher import KafkaMessageFetcher
+from streampipes.model.common import random_letters
+
+logger = logging.getLogger(__name__)
+
+
+class KafkaBroker(Broker):
+    """Implementation of the NatsBroker"""
+
+    async def _makeConnection(self, hostname: str, port: int) -> None:
+        """Helper function to connect to a server.
+
+        Parameters
+        ----------
+
+        hostname: str
+            The hostname of the of the server, which the broker connects to.
+
+        port: int
+            The port number of the connection.
+
+        Returns
+        -------
+        None
+        """
+        self.kafka_consumer = Consumer(
+            {"bootstrap.servers": f"{hostname}:{port}", "group.id": random_letters(6), "auto.offset.reset": "latest"}
+        )
+
+    async def createSubscription(self) -> None:
+        """Creates a subscription to a data stream.
+
+        Returns
+        -------
+        None
+        """
+        self.kafka_consumer.subscribe([self.topic_name])
+
+        logger.info(f"Subscribed to stream: {self.stream_id}")
+
+    async def publish_event(self, event: Dict[str, Any]):
+        """Publish an event to a connected data stream.
+
+        Parameters
+        ----------
+         event: Dict[str, Any]
+            The event to be published.
+
+        Returns
+        -------
+        None
+        """
+
+        # await self.publish(subject=self.topic_name, payload=json.dumps(event).encode("utf-8"))
+
+    async def disconnect(self) -> None:
+        """Closes the connection to the server.
+
+        Returns
+        -------
+        None
+        """
+        self.kafka_consumer.close()
+        logger.info(f"Stopped connection to stream: {self.stream_id}")
+
+    def get_message(self) -> AsyncIterator:
+        """Get the published messages of the subscription.
+
+        Returns
+        -------
+        An async iterator for the messages.
+        """
+
+        return KafkaMessageFetcher(self.kafka_consumer)
diff --git a/streampipes-client-python/streampipes/functions/broker/__init__.py b/streampipes-client-python/streampipes/functions/broker/kafka_message_fetcher.py
similarity index 53%
copy from streampipes-client-python/streampipes/functions/broker/__init__.py
copy to streampipes-client-python/streampipes/functions/broker/kafka_message_fetcher.py
index 45ffbdc7c..56bbf46c9 100644
--- a/streampipes-client-python/streampipes/functions/broker/__init__.py
+++ b/streampipes-client-python/streampipes/functions/broker/kafka_message_fetcher.py
@@ -14,14 +14,37 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from .broker import Broker
-from .nats_broker import NatsBroker
+from confluent_kafka import Consumer  # type: ignore
 
-from .broker_handler import SupportedBroker, get_broker  # isort: skip
 
-__all__ = [
-    "Broker",
-    "NatsBroker",
-    "SupportedBroker",
-    "get_broker",
-]
+class KafkaMsg:
+    """An internal representation of a Kafka message
+
+    Parameters
+    ----------
+    data: Byte Array
+        The received Kafka message as byte array
+    """
+
+    def __init__(self, data):
+        self.data = data
+
+
+class KafkaMessageFetcher:
+    """Fetches the next message from Kafka
+
+    Parameters
+    ----------
+    consumer: Consumer
+        The Kafka consumer
+    """
+
+    def __init__(self, consumer: Consumer):
+        self.consumer = consumer
+
+    def __aiter__(self):
+        return self
+
+    async def __anext__(self):
+        msg = self.consumer.poll(0.1)
+        return KafkaMsg(msg.value())
diff --git a/streampipes-client-python/streampipes/model/common.py b/streampipes-client-python/streampipes/model/common.py
index edc24b955..a6c21aa84 100644
--- a/streampipes-client-python/streampipes/model/common.py
+++ b/streampipes-client-python/streampipes/model/common.py
@@ -93,8 +93,8 @@ class EventProperty(BasicModel):
     description: Optional[StrictStr]
     runtime_name: StrictStr
     required: StrictBool = Field(default=False)
-    domain_properties: List[StrictStr] = Field(default_factory=list)
-    property_scope: StrictStr = Field(default="MEASUREMENT_PROPERTY")
+    domain_properties: Optional[List[StrictStr]] = Field(default_factory=list)
+    property_scope: Optional[StrictStr] = Field(default="MEASUREMENT_PROPERTY")
     index: StrictInt = Field(default=0)
     runtime_id: Optional[StrictStr]
     runtime_type: StrictStr = Field(default="http://www.w3.org/2001/XMLSchema#string")
diff --git a/streampipes-client-python/streampipes/model/resource/data_lake_measure.py b/streampipes-client-python/streampipes/model/resource/data_lake_measure.py
index 1dcbe3a4a..d72732afa 100644
--- a/streampipes-client-python/streampipes/model/resource/data_lake_measure.py
+++ b/streampipes-client-python/streampipes/model/resource/data_lake_measure.py
@@ -52,4 +52,4 @@ class DataLakeMeasure(Resource):
     pipeline_id: Optional[StrictStr]
     pipeline_name: Optional[StrictStr]
     pipeline_is_running: StrictBool
-    schema_version: StrictStr
+    schema_version: Optional[StrictStr]


[streampipes] 03/03: docs: add matomo tracking to python docs (#1409)

Posted by bo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bossenti pushed a commit to branch rel/0.91.0
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit c0c97b0e71d0c29c7ca825ed5d80e12881419f3f
Author: Tim <50...@users.noreply.github.com>
AuthorDate: Sat Mar 11 14:06:48 2023 +0100

    docs: add matomo tracking to python docs (#1409)
    
    Signed-off-by: bossenti <bo...@posteo.de>
---
 .../partials/integrations/analytics/matomo.html    | 36 ++++++++++++++++++++++
 streampipes-client-python/mkdocs.yml               |  2 ++
 2 files changed, 38 insertions(+)

diff --git a/streampipes-client-python/docs/overrides/partials/integrations/analytics/matomo.html b/streampipes-client-python/docs/overrides/partials/integrations/analytics/matomo.html
new file mode 100644
index 000000000..3df831b50
--- /dev/null
+++ b/streampipes-client-python/docs/overrides/partials/integrations/analytics/matomo.html
@@ -0,0 +1,36 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~    http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~
+-->
+<script>
+    var _paq = window._paq = window._paq || [];
+    /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
+    /* We explicitly disable cookie tracking to avoid privacy issues */
+    _paq.push(['disableCookies']);
+    /* Measure a visit to flink.apache.org and nightlies.apache.org/flink as the same visit */
+    _paq.push(['trackPageView']);
+    _paq.push(['enableLinkTracking']);
+    (function () {
+        var u = "//analytics.apache.org/";
+        _paq.push(['setTrackerUrl', u + 'matomo.php']);
+        _paq.push(['setSiteId', '35']);
+        var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
+        g.async = true;
+        g.src = u + 'matomo.js';
+        s.parentNode.insertBefore(g, s);
+    })();
+</script>
+
diff --git a/streampipes-client-python/mkdocs.yml b/streampipes-client-python/mkdocs.yml
index 373d76c86..68fec6b1f 100644
--- a/streampipes-client-python/mkdocs.yml
+++ b/streampipes-client-python/mkdocs.yml
@@ -37,6 +37,8 @@ extra:
   social:
     - icon: fontawesome/brands/github-alt
       link: https://github.com/apache/streampipes
+  analytics:
+    provider: matomo
 
   version:
     provider: mike