omnata-plugin-runtime 0.10.3__py3-none-any.whl → 0.10.4a230__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.
- omnata_plugin_runtime/json_schema.py +25 -2
- {omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/RECORD +5 -5
- {omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/WHEEL +0 -0
@@ -7,6 +7,7 @@ from typing import Any, Dict, Optional, Literal, List, Union
|
|
7
7
|
from typing_extensions import Self
|
8
8
|
from pydantic import BaseModel, Field, model_validator, computed_field
|
9
9
|
from jinja2 import Environment
|
10
|
+
from .logging import logger
|
10
11
|
|
11
12
|
class JsonSchemaProperty(BaseModel):
|
12
13
|
"""
|
@@ -48,6 +49,9 @@ class JsonSchemaProperty(BaseModel):
|
|
48
49
|
isJoinColumn: Optional[bool] = Field(
|
49
50
|
False, description="Whether this column is sourced from a joined stream"
|
50
51
|
)
|
52
|
+
requiredStreamNames: Optional[List[str]] = Field(
|
53
|
+
None, description="The names of the streams that are depended upon by this column, via joins. If these streams are not selected, the column will be omitted."
|
54
|
+
)
|
51
55
|
|
52
56
|
@model_validator(mode='after')
|
53
57
|
def validate(self) -> Self:
|
@@ -155,6 +159,9 @@ class SnowflakeViewColumn(BaseModel):
|
|
155
159
|
is_join_column: Optional[bool] = Field(
|
156
160
|
default=False, description="Whether this column is sourced from a joined stream"
|
157
161
|
)
|
162
|
+
required_stream_names: Optional[List[str]] = Field(
|
163
|
+
default=None, description="The names of the streams that are depended upon by this column, via joins. If these streams are not selected, the column will be omitted"
|
164
|
+
)
|
158
165
|
|
159
166
|
def __repr__(self) -> str:
|
160
167
|
return "SnowflakeViewColumn(name=%r, definition=%r, comment=%r)" % (
|
@@ -210,11 +217,15 @@ class SnowflakeViewColumn(BaseModel):
|
|
210
217
|
else:
|
211
218
|
if not json_schema_property.snowflakeColumnExpression:
|
212
219
|
expression=f"""{expression}::{json_schema_property.snowflake_data_type}"""
|
220
|
+
required_stream_names = None
|
221
|
+
if json_schema_property.requiredStreamNames:
|
222
|
+
required_stream_names = json_schema_property.requiredStreamNames
|
213
223
|
return cls(
|
214
224
|
name=final_column_name,
|
215
225
|
expression=expression,
|
216
226
|
comment=comment,
|
217
227
|
is_join_column=json_schema_property.isJoinColumn,
|
228
|
+
required_stream_names=required_stream_names
|
218
229
|
)
|
219
230
|
|
220
231
|
@classmethod
|
@@ -437,9 +448,9 @@ class SnowflakeViewParts(BaseModel):
|
|
437
448
|
joined_parts = []
|
438
449
|
for join in main_stream_view_part.joins:
|
439
450
|
if join.join_stream_name not in raw_stream_locations:
|
440
|
-
|
451
|
+
continue
|
441
452
|
if join.join_stream_name not in stream_schemas:
|
442
|
-
|
453
|
+
continue
|
443
454
|
joined_parts.append(normalized_view_part(
|
444
455
|
stream_name=join.join_stream_name,
|
445
456
|
raw_table_location=raw_stream_locations[join.join_stream_name],
|
@@ -448,6 +459,18 @@ class SnowflakeViewParts(BaseModel):
|
|
448
459
|
column_name_environment=column_name_environment,
|
449
460
|
column_name_expression=column_name_expression
|
450
461
|
))
|
462
|
+
# For each column, the plugin can advise which streams are required for the join, which comes through as required_stream_names
|
463
|
+
# on the SnowflakeViewColumn object.
|
464
|
+
# Until this generate function is called with the raw stream names, we don't know which streams the user has actually selected.
|
465
|
+
# So now there's a pruning process where we remove columns from the main view part that depend on streams that are not selected
|
466
|
+
for column in main_stream_view_part.columns:
|
467
|
+
if column.required_stream_names:
|
468
|
+
for required_stream_name in column.required_stream_names:
|
469
|
+
if required_stream_name not in raw_stream_locations:
|
470
|
+
logger.warning(f"Column {column.name} in stream {stream_name} requires stream {required_stream_name} to be selected, but it was not provided")
|
471
|
+
main_stream_view_part.columns.remove(column)
|
472
|
+
break
|
473
|
+
|
451
474
|
return cls(main_part=main_stream_view_part, joined_parts=joined_parts)
|
452
475
|
|
453
476
|
|
{omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/RECORD
RENAMED
@@ -2,12 +2,12 @@ omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTw
|
|
2
2
|
omnata_plugin_runtime/api.py,sha256=baGraSMiD4Yvi3ZWrEv_TKh8Ktd1U8riBdOpe9j0Puw,8202
|
3
3
|
omnata_plugin_runtime/configuration.py,sha256=f4ssL8ckqlG6vrUZEaX5SvirS4Tdrstl66ZZxVzBado,42457
|
4
4
|
omnata_plugin_runtime/forms.py,sha256=9YHJ_T17lT-rwyDaUg_0yj_YMPda4DRCw_wrvf8hE0E,19964
|
5
|
-
omnata_plugin_runtime/json_schema.py,sha256=
|
5
|
+
omnata_plugin_runtime/json_schema.py,sha256=iBeOo-D7bFQQ6aIFOtkNYYx16GEFozr9-iHxjAJ16FY,28223
|
6
6
|
omnata_plugin_runtime/logging.py,sha256=WBuZt8lF9E5oFWM4KYQbE8dDJ_HctJ1pN3BHwU6rcd0,4461
|
7
7
|
omnata_plugin_runtime/omnata_plugin.py,sha256=M0b6f9lKKEoEI0zf-ZwZcIPKPQTmHTIMhvcrBc94Mhg,133278
|
8
8
|
omnata_plugin_runtime/plugin_entrypoints.py,sha256=iqGl8_nEEnPGKg3Aem4YLSQ6d5xS3ju5gq8MJbx6sCA,31968
|
9
9
|
omnata_plugin_runtime/rate_limiting.py,sha256=qpr5esU4Ks8hMzuMpSR3gLFdor2ZUXYWCjmsQH_K6lQ,25882
|
10
|
-
omnata_plugin_runtime-0.10.
|
11
|
-
omnata_plugin_runtime-0.10.
|
12
|
-
omnata_plugin_runtime-0.10.
|
13
|
-
omnata_plugin_runtime-0.10.
|
10
|
+
omnata_plugin_runtime-0.10.4a230.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
11
|
+
omnata_plugin_runtime-0.10.4a230.dist-info/METADATA,sha256=o59eFbaituLMTRsAiEnxjx5erzQbydFFwi9Fb7wMB7k,2211
|
12
|
+
omnata_plugin_runtime-0.10.4a230.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
13
|
+
omnata_plugin_runtime-0.10.4a230.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.10.3.dist-info → omnata_plugin_runtime-0.10.4a230.dist-info}/LICENSE
RENAMED
File without changes
|
File without changes
|