gooddata-flexconnect 1.41.1.dev1__tar.gz → 1.41.1.dev3__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.
Files changed (19) hide show
  1. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/PKG-INFO +4 -4
  2. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/__init__.py +5 -0
  3. gooddata_flexconnect-1.41.1.dev3/gooddata_flexconnect/function/data_source_messages.py +101 -0
  4. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect.egg-info/PKG-INFO +4 -4
  5. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect.egg-info/SOURCES.txt +1 -0
  6. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect.egg-info/requires.txt +2 -2
  7. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/setup.py +4 -4
  8. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/LICENSE.txt +0 -0
  9. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/README.md +0 -0
  10. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/__init__.py +0 -0
  11. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/execution_context.py +0 -0
  12. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/flight_methods.py +0 -0
  13. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/function.py +0 -0
  14. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/function_registry.py +0 -0
  15. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/function/function_task.py +0 -0
  16. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect/py.typed +0 -0
  17. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect.egg-info/dependency_links.txt +0 -0
  18. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/gooddata_flexconnect.egg-info/top_level.txt +0 -0
  19. {gooddata_flexconnect-1.41.1.dev1 → gooddata_flexconnect-1.41.1.dev3}/setup.cfg +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gooddata-flexconnect
3
- Version: 1.41.1.dev1
3
+ Version: 1.41.1.dev3
4
4
  Summary: Build your own data source for GoodData Cloud and GoodData Cloud Native.
5
5
  Author: GoodData
6
6
  Author-email: support@gooddata.com
7
7
  License: MIT
8
- Project-URL: Documentation, https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev1
8
+ Project-URL: Documentation, https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev3
9
9
  Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
10
10
  Keywords: gooddata,flight,rpc,flight rpc,custom functions,analytics,headless,business,intelligence,headless-bi,cloud,native,semantic,layer,sql,metrics
11
11
  Classifier: Development Status :: 4 - Beta
@@ -24,8 +24,8 @@ Requires-Python: >=3.9.0
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE.txt
26
26
  Requires-Dist: dynaconf<4.0.0,>=3.1.11
27
- Requires-Dist: gooddata-flight-server~=1.41.1.dev1
28
- Requires-Dist: gooddata-sdk~=1.41.1.dev1
27
+ Requires-Dist: gooddata-flight-server~=1.41.1.dev3
28
+ Requires-Dist: gooddata-sdk~=1.41.1.dev3
29
29
  Requires-Dist: orjson<4.0.0,>=3.9.15
30
30
  Requires-Dist: pyarrow>=16.1.0
31
31
  Requires-Dist: structlog<25.0.0,>=24.0.0
@@ -1,5 +1,10 @@
1
1
  # (C) 2024 GoodData Corporation
2
2
 
3
+ from gooddata_flexconnect.function.data_source_messages import (
4
+ DataSourceMessage,
5
+ add_data_source_messages_metadata,
6
+ with_data_source_messages,
7
+ )
3
8
  from gooddata_flexconnect.function.execution_context import (
4
9
  ExecutionContext,
5
10
  ExecutionContextAbsoluteDateFilter,
@@ -0,0 +1,101 @@
1
+ # (C) 2025 GoodData Corporation
2
+ from collections.abc import Iterable
3
+ from dataclasses import dataclass
4
+ from typing import Any, Optional
5
+
6
+ import orjson
7
+ import pyarrow
8
+
9
+ _DATA_SOURCE_MESSAGES_KEY = b"x-gdc-data-source-messages"
10
+ """
11
+ Key used in the PyArrow metadata to carry the data source messages.
12
+ """
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class DataSourceMessage:
17
+ """
18
+ A message sent by the data source. This will be included in the execution results' metadata.
19
+ """
20
+
21
+ source: str
22
+ """
23
+ Identification of the source of the message, typically the id or other identifier of the data source.
24
+ """
25
+
26
+ correlation_id: str
27
+ """
28
+ Unique id of the operation, meant to correlate different messages together.
29
+ """
30
+
31
+ type: str
32
+ """
33
+ Type of the message, currently free-form, we might define some enum for these in the future.
34
+ """
35
+
36
+ data: Optional[Any] = None
37
+ """
38
+ Optional message-specific data. This can be anything that can be JSON-serialized.
39
+ Try to keep this as small as possible: the backend has a quite strict size limit on the messages.
40
+ """
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ """
44
+ Converts this instance to its dictionary representation.
45
+ """
46
+ return {"source": self.source, "correlation_id": self.correlation_id, "type": self.type, "data": self.data}
47
+
48
+
49
+ def add_data_source_messages_metadata(
50
+ data_source_messages: Iterable[DataSourceMessage], original_metadata: Optional[dict] = None
51
+ ) -> dict[bytes, bytes]:
52
+ """
53
+ Given a list of DataSourceMessages, creates a PyArrow-compatible metadata dictionary.
54
+
55
+ This is useful when creating a PyArrow Table directly:
56
+
57
+ >>> t = pyarrow.table(
58
+ ... [1, 2, 3],
59
+ ... ["test"],
60
+ ... metadata=add_data_source_messages_metadata(
61
+ ... [DataSourceMessage(correlation_id="123", source="test_source", type="info")]
62
+ ... ),
63
+ ... )
64
+
65
+ You can also add other metadata as needed:
66
+ >>> t2 = pyarrow.table(
67
+ ... [1, 2, 3],
68
+ ... ["test"],
69
+ ... metadata=add_data_source_messages_metadata(
70
+ ... [DataSourceMessage(correlation_id="123", source="test_source", type="info")],
71
+ ... original_metadata={b"some": b"extra metadata"},
72
+ ... ),
73
+ ... )
74
+
75
+ :param data_source_messages: list of DataSourceMessages to include
76
+ :param original_metadata: original medata to add the DataSourceMessages to.
77
+ :return: a new metadata dictionary
78
+ """
79
+ if original_metadata is None:
80
+ original_metadata = {}
81
+ return {**original_metadata, _DATA_SOURCE_MESSAGES_KEY: orjson.dumps(data_source_messages)}
82
+
83
+
84
+ def with_data_source_messages(
85
+ data_source_messages: Iterable[DataSourceMessage], schema: pyarrow.Schema
86
+ ) -> pyarrow.Schema:
87
+ """
88
+ Given a schema and a list of DataSourceMessages, returns a new schema with the DataSourceMessages included.
89
+
90
+ This is useful when creating PyArrow RecordBatchReaders:
91
+
92
+ >>> s = with_data_source_messages(
93
+ ... [DataSourceMessage(correlation_id="123", source="test_source", type="info")],
94
+ ... pyarrow.schema(...), # the original schema for your RecordBatchReader
95
+ ... )
96
+ >>> rbr = pyarrow.RecordBatchReader.from_batches(schema=s, batches=...)
97
+
98
+ :param schema: the schema to enrich with the DataSourceMessages
99
+ :param data_source_messages: list of DataSourceMessages to include
100
+ """
101
+ return schema.with_metadata(add_data_source_messages_metadata(data_source_messages, schema.metadata))
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gooddata-flexconnect
3
- Version: 1.41.1.dev1
3
+ Version: 1.41.1.dev3
4
4
  Summary: Build your own data source for GoodData Cloud and GoodData Cloud Native.
5
5
  Author: GoodData
6
6
  Author-email: support@gooddata.com
7
7
  License: MIT
8
- Project-URL: Documentation, https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev1
8
+ Project-URL: Documentation, https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev3
9
9
  Project-URL: Source, https://github.com/gooddata/gooddata-python-sdk
10
10
  Keywords: gooddata,flight,rpc,flight rpc,custom functions,analytics,headless,business,intelligence,headless-bi,cloud,native,semantic,layer,sql,metrics
11
11
  Classifier: Development Status :: 4 - Beta
@@ -24,8 +24,8 @@ Requires-Python: >=3.9.0
24
24
  Description-Content-Type: text/markdown
25
25
  License-File: LICENSE.txt
26
26
  Requires-Dist: dynaconf<4.0.0,>=3.1.11
27
- Requires-Dist: gooddata-flight-server~=1.41.1.dev1
28
- Requires-Dist: gooddata-sdk~=1.41.1.dev1
27
+ Requires-Dist: gooddata-flight-server~=1.41.1.dev3
28
+ Requires-Dist: gooddata-sdk~=1.41.1.dev3
29
29
  Requires-Dist: orjson<4.0.0,>=3.9.15
30
30
  Requires-Dist: pyarrow>=16.1.0
31
31
  Requires-Dist: structlog<25.0.0,>=24.0.0
@@ -9,6 +9,7 @@ gooddata_flexconnect.egg-info/dependency_links.txt
9
9
  gooddata_flexconnect.egg-info/requires.txt
10
10
  gooddata_flexconnect.egg-info/top_level.txt
11
11
  gooddata_flexconnect/function/__init__.py
12
+ gooddata_flexconnect/function/data_source_messages.py
12
13
  gooddata_flexconnect/function/execution_context.py
13
14
  gooddata_flexconnect/function/flight_methods.py
14
15
  gooddata_flexconnect/function/function.py
@@ -1,6 +1,6 @@
1
1
  dynaconf<4.0.0,>=3.1.11
2
- gooddata-flight-server~=1.41.1.dev1
3
- gooddata-sdk~=1.41.1.dev1
2
+ gooddata-flight-server~=1.41.1.dev3
3
+ gooddata-sdk~=1.41.1.dev3
4
4
  orjson<4.0.0,>=3.9.15
5
5
  pyarrow>=16.1.0
6
6
  structlog<25.0.0,>=24.0.0
@@ -8,8 +8,8 @@ long_description = (this_directory / "README.md").read_text(encoding="utf-8")
8
8
 
9
9
  REQUIRES = [
10
10
  "dynaconf>=3.1.11,<4.0.0",
11
- "gooddata-flight-server~=1.41.1.dev1",
12
- "gooddata-sdk~=1.41.1.dev1",
11
+ "gooddata-flight-server~=1.41.1.dev3",
12
+ "gooddata-sdk~=1.41.1.dev3",
13
13
  "orjson>=3.9.15,<4.0.0",
14
14
  "pyarrow>=16.1.0",
15
15
  "structlog>=24.0.0,<25.0.0",
@@ -20,7 +20,7 @@ setup(
20
20
  description="Build your own data source for GoodData Cloud and GoodData Cloud Native.",
21
21
  long_description=long_description,
22
22
  long_description_content_type="text/markdown",
23
- version="1.41.1.dev1",
23
+ version="1.41.1.dev3",
24
24
  author="GoodData",
25
25
  author_email="support@gooddata.com",
26
26
  license="MIT",
@@ -31,7 +31,7 @@ setup(
31
31
  include_package_data=True,
32
32
  python_requires=">=3.9.0",
33
33
  project_urls={
34
- "Documentation": "https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev1",
34
+ "Documentation": "https://gooddata-flexconnect.readthedocs.io/en/v1.41.1.dev3",
35
35
  "Source": "https://github.com/gooddata/gooddata-python-sdk",
36
36
  },
37
37
  classifiers=[