omnata-plugin-runtime 0.10.5a233__py3-none-any.whl → 0.10.6a235__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/configuration.py +2 -0
- omnata_plugin_runtime/json_schema.py +23 -8
- {omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/METADATA +1 -1
- {omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/RECORD +6 -6
- {omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/LICENSE +0 -0
- {omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/WHEEL +0 -0
@@ -505,6 +505,8 @@ class InboundSyncStreamsConfiguration(SubscriptableBaseModel):
|
|
505
505
|
@model_validator(mode='before')
|
506
506
|
@classmethod
|
507
507
|
def migrate_bulk_configuration(cls, data: Any) -> Any:
|
508
|
+
if 'sync_strategy_bulk_configuration' in data or 'storage_behaviour_bulk_configuration' in data:
|
509
|
+
return data
|
508
510
|
if 'bulk_configuration' in data:
|
509
511
|
# Recently deprecated values
|
510
512
|
# AUTO_MERGE = "Auto / Merge changes" # Merge
|
@@ -154,6 +154,9 @@ class SnowflakeViewColumn(BaseModel):
|
|
154
154
|
In other words, the column definition is "expression as name".
|
155
155
|
"""
|
156
156
|
name: str
|
157
|
+
original_name: str = Field(
|
158
|
+
..., description="The name of the column before the column naming transformation is applied"
|
159
|
+
)
|
157
160
|
expression: str
|
158
161
|
comment: Optional[str] = Field(default=None)
|
159
162
|
is_join_column: Optional[bool] = Field(
|
@@ -170,7 +173,13 @@ class SnowflakeViewColumn(BaseModel):
|
|
170
173
|
self.comment,
|
171
174
|
)
|
172
175
|
|
173
|
-
def definition(self) -> str:
|
176
|
+
def definition(self,original_name:bool = False) -> str:
|
177
|
+
"""
|
178
|
+
Returns the column definition for a normalized view.
|
179
|
+
If original_name is True, the original name will be used instead of the transformed name.
|
180
|
+
"""
|
181
|
+
if original_name:
|
182
|
+
return f'{self.expression} as "{self.original_name}"'
|
174
183
|
return f'{self.expression} as "{self.name}"'
|
175
184
|
|
176
185
|
def name_with_comment(self,binding_list:Optional[List[Any]] = None) -> str:
|
@@ -222,6 +231,7 @@ class SnowflakeViewColumn(BaseModel):
|
|
222
231
|
required_stream_names = json_schema_property.requiredStreamNames
|
223
232
|
return cls(
|
224
233
|
name=final_column_name,
|
234
|
+
original_name=column_name,
|
225
235
|
expression=expression,
|
226
236
|
comment=comment,
|
227
237
|
is_join_column=json_schema_property.isJoinColumn,
|
@@ -383,12 +393,12 @@ class SnowflakeViewPart(BaseModel):
|
|
383
393
|
c.name_with_comment(binding_list) for c in (self.direct_columns() + self.join_columns())
|
384
394
|
]
|
385
395
|
|
386
|
-
def cte_text(self) -> str:
|
396
|
+
def cte_text(self,original_name: bool = False) -> str:
|
387
397
|
"""
|
388
398
|
Returns the CTE text for this view part.
|
389
399
|
"""
|
390
400
|
return f""" "{self.stream_name}" as (
|
391
|
-
select {', '.join([c.definition() for c in self.direct_columns()])}
|
401
|
+
select {', '.join([c.definition(original_name=original_name) for c in self.direct_columns()])}
|
392
402
|
from {self.raw_table_location.get_fully_qualified_name()}
|
393
403
|
) """
|
394
404
|
|
@@ -407,14 +417,19 @@ class SnowflakeViewParts(BaseModel):
|
|
407
417
|
|
408
418
|
def view_body(self):
|
409
419
|
"""
|
410
|
-
Creates a view definition from the parts
|
420
|
+
Creates a view definition from the parts.
|
421
|
+
The view will consist of CTEs for all of the involved streams, and these will use their original column names without transformation.
|
422
|
+
There will be a final SELECT statement that selects all columns from the main stream, and then adds any columns obtained via joins.
|
423
|
+
In the final select statement, the join columns will be aliased with their transformed names.
|
411
424
|
"""
|
412
|
-
ctes = [self.main_part.cte_text()] + [part.cte_text() for part in self.joined_parts]
|
425
|
+
ctes = [self.main_part.cte_text(original_name=True)] + [part.cte_text(original_name=True) for part in self.joined_parts]
|
413
426
|
all_ctes = "\n,".join(ctes)
|
427
|
+
direct_columns = self.main_part.direct_columns()
|
414
428
|
join_columns = self.main_part.join_columns()
|
415
|
-
|
416
|
-
|
417
|
-
|
429
|
+
direct_column_clauses = [c.definition(original_name=True) for c in direct_columns]
|
430
|
+
join_column_clauses = [c.definition(original_name=False) for c in join_columns]
|
431
|
+
# the joined columns may reference the direct columns, so we need to order them correctly
|
432
|
+
final_column_clauses = direct_column_clauses + join_column_clauses
|
418
433
|
view_body = f"""with {all_ctes}
|
419
434
|
select {', '.join(final_column_clauses)}
|
420
435
|
from "{self.main_part.stream_name}" """
|
{omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/RECORD
RENAMED
@@ -1,13 +1,13 @@
|
|
1
1
|
omnata_plugin_runtime/__init__.py,sha256=MS9d1whnfT_B3-ThqZ7l63QeC_8OEKTuaYV5wTwRpBA,1576
|
2
2
|
omnata_plugin_runtime/api.py,sha256=baGraSMiD4Yvi3ZWrEv_TKh8Ktd1U8riBdOpe9j0Puw,8202
|
3
|
-
omnata_plugin_runtime/configuration.py,sha256=
|
3
|
+
omnata_plugin_runtime/configuration.py,sha256=fpSyBr3Dr7GNdil88915VtMwRy5pexkGCRBk7BLFpPs,46527
|
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=DB4bLNQ3mDvB8G0EQY2RiPwTe3H_PQKxa61ryTbpyEQ,29481
|
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.6a235.dist-info/LICENSE,sha256=rGaMQG3R3F5-JGDp_-rlMKpDIkg5n0SI4kctTk8eZSI,56
|
11
|
+
omnata_plugin_runtime-0.10.6a235.dist-info/METADATA,sha256=CPI4nTz1LjXxvTejYOvdNe54rs-l8WEklh8e5H_C11c,2211
|
12
|
+
omnata_plugin_runtime-0.10.6a235.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
13
|
+
omnata_plugin_runtime-0.10.6a235.dist-info/RECORD,,
|
{omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/LICENSE
RENAMED
File without changes
|
{omnata_plugin_runtime-0.10.5a233.dist-info → omnata_plugin_runtime-0.10.6a235.dist-info}/WHEEL
RENAMED
File without changes
|