omnata-plugin-runtime 0.10.6a246__tar.gz → 0.10.7__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.
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/configuration.py +39 -34
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/json_schema.py +36 -18
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/LICENSE +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/README.md +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/omnata_plugin.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/rate_limiting.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "omnata-plugin-runtime"
|
3
|
-
version = "0.10.
|
3
|
+
version = "0.10.7"
|
4
4
|
description = "Classes and common runtime components for building and running Omnata Plugins"
|
5
5
|
authors = ["James Weakley <james.weakley@omnata.com>"]
|
6
6
|
readme = "README.md"
|
@@ -494,8 +494,8 @@ class InboundSyncStreamsConfiguration(SubscriptableBaseModel):
|
|
494
494
|
included_streams: Dict[str, StoredStreamConfiguration]
|
495
495
|
excluded_streams: List[str]
|
496
496
|
bulk_configuration: Optional[InboundSyncBulkConfiguration] = None
|
497
|
-
sync_strategy_bulk_configuration: InboundSyncStrategyBulkConfiguration
|
498
|
-
storage_behaviour_bulk_configuration: InboundStorageBehaviourBulkConfiguration
|
497
|
+
sync_strategy_bulk_configuration: Optional[InboundSyncStrategyBulkConfiguration] = None
|
498
|
+
storage_behaviour_bulk_configuration: Optional[InboundStorageBehaviourBulkConfiguration] = None
|
499
499
|
|
500
500
|
"""
|
501
501
|
We use a model_validator to manage the migration from bulk_configuration to the new
|
@@ -505,39 +505,44 @@ 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
|
508
|
+
if 'sync_strategy_bulk_configuration' in data \
|
509
|
+
and data['sync_strategy_bulk_configuration'] is not None \
|
510
|
+
and 'storage_behaviour_bulk_configuration' in data \
|
511
|
+
and data['storage_behaviour_bulk_configuration'] is not None:
|
509
512
|
return data
|
510
|
-
if 'bulk_configuration' in data:
|
511
|
-
#
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
513
|
+
if 'bulk_configuration' not in data:
|
514
|
+
# This was previously a default value
|
515
|
+
data['bulk_configuration'] = InboundSyncBulkConfiguration.CUSTOMIZE.value
|
516
|
+
# Recently deprecated values
|
517
|
+
# AUTO_MERGE = "Auto / Merge changes" # Merge
|
518
|
+
# AUTO_APPEND = "Auto / Keep history" # Append
|
519
|
+
# CUSTOMIZE = "Customize - choose sync behaviours for each object"
|
520
|
+
# Deprecated longer ago
|
521
|
+
# ALL_FULL_REPLACE = "All Objects - Full refresh / Replace"
|
522
|
+
# ALL_FULL_APPEND = "All Objects - Full refresh / Append"
|
523
|
+
# ALL_INCR_MERGE = "All Objects - Incremental / Merge"
|
524
|
+
# ALL_INCR_APPEND = "All Objects - Incremental / Append"
|
525
|
+
if data['bulk_configuration']== InboundSyncBulkConfiguration.AUTO_MERGE.value:
|
526
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.AUTO.value
|
527
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.MERGE.value
|
528
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.AUTO_APPEND.value:
|
529
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.AUTO.value
|
530
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.APPEND.value
|
531
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.CUSTOMIZE.value:
|
532
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.MANUAL.value
|
533
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.MANUAL.value
|
534
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.ALL_FULL_REPLACE.value:
|
535
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.MANUAL.value
|
536
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.MERGE.value
|
537
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.ALL_FULL_APPEND.value:
|
538
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.MANUAL.value
|
539
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.APPEND.value
|
540
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.ALL_INCR_MERGE.value:
|
541
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.AUTO.value
|
542
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.MERGE.value
|
543
|
+
elif data['bulk_configuration']== InboundSyncBulkConfiguration.ALL_INCR_APPEND.value:
|
544
|
+
data['sync_strategy_bulk_configuration']= InboundSyncStrategyBulkConfiguration.AUTO.value
|
545
|
+
data['storage_behaviour_bulk_configuration']= InboundStorageBehaviourBulkConfiguration.APPEND.value
|
541
546
|
# remove this once the old UI is deprecated
|
542
547
|
#del data['bulk_configuration']
|
543
548
|
return data
|
@@ -242,7 +242,7 @@ class SnowflakeViewColumn(BaseModel):
|
|
242
242
|
)
|
243
243
|
|
244
244
|
@classmethod
|
245
|
-
def order_by_reference(cls,
|
245
|
+
def order_by_reference(cls,columns:List[Self]) -> List[Self]:
|
246
246
|
"""
|
247
247
|
In some situations, column expressions may reference the alias of another column
|
248
248
|
This is allowed in Snowflake, as long as the aliased column is defined before it's used in a later column
|
@@ -251,17 +251,26 @@ class SnowflakeViewColumn(BaseModel):
|
|
251
251
|
|
252
252
|
# Collect columns to be moved
|
253
253
|
columns_to_move:List[Self] = []
|
254
|
-
|
255
|
-
|
254
|
+
# Collect Omnata System columns and keep them at the front
|
255
|
+
omnata_system_columns_start = []
|
256
|
+
for column in columns[:]:
|
257
|
+
if column.original_name.startswith("OMNATA_"):
|
258
|
+
columns.remove(column)
|
259
|
+
omnata_system_columns_start.append(column)
|
260
|
+
|
261
|
+
for column in columns:
|
262
|
+
for other_column in columns:
|
263
|
+
if column==other_column:
|
264
|
+
continue
|
256
265
|
if f'"{column.original_name}"' in other_column.expression:
|
257
266
|
if column not in columns_to_move:
|
258
267
|
columns_to_move.append(column)
|
259
268
|
|
260
269
|
# Move collected columns to the front
|
261
270
|
for column in columns_to_move:
|
262
|
-
|
263
|
-
|
264
|
-
return
|
271
|
+
columns.remove(column)
|
272
|
+
columns.insert(0, column)
|
273
|
+
return omnata_system_columns_start + columns
|
265
274
|
|
266
275
|
|
267
276
|
class SnowflakeViewJoin(BaseModel):
|
@@ -369,13 +378,13 @@ class SnowflakeViewPart(BaseModel):
|
|
369
378
|
"""
|
370
379
|
Returns the columns that are not sourced from joins.
|
371
380
|
"""
|
372
|
-
return
|
381
|
+
return [c for c in self.columns if not c.is_join_column]
|
373
382
|
|
374
383
|
def join_columns(self) -> List[SnowflakeViewColumn]:
|
375
384
|
"""
|
376
385
|
Returns the columns that are sourced from joins.
|
377
386
|
"""
|
378
|
-
return
|
387
|
+
return [c for c in self.columns if c.is_join_column]
|
379
388
|
|
380
389
|
def comment_clause(self) -> str:
|
381
390
|
"""
|
@@ -393,7 +402,7 @@ class SnowflakeViewPart(BaseModel):
|
|
393
402
|
# the outer view definition has all of the column names and comments, but with the direct columns
|
394
403
|
# first and the join columns last, same as they are ordered in the inner query
|
395
404
|
return [
|
396
|
-
c.name_with_comment(binding_list) for c in
|
405
|
+
c.name_with_comment(binding_list) for c in self.columns
|
397
406
|
]
|
398
407
|
|
399
408
|
def cte_text(self,original_name: bool = False) -> str:
|
@@ -431,25 +440,26 @@ class SnowflakeViewParts(BaseModel):
|
|
431
440
|
final_cte = f""" OMNATA_FINAL_CTE as (
|
432
441
|
select {', '.join(
|
433
442
|
[
|
434
|
-
f'"{c.original_name}"' for c in self.main_part.direct_columns()
|
443
|
+
f'"{self.main_part.stream_name}"."{c.original_name}"' for c in self.main_part.direct_columns()
|
435
444
|
]+[
|
436
445
|
c.definition(original_name=True) for c in self.main_part.join_columns()
|
437
446
|
])}
|
438
|
-
from "{self.main_part.stream_name}"
|
439
|
-
)
|
447
|
+
from "{self.main_part.stream_name}" """
|
448
|
+
if len(self.main_part.joins) > 0:
|
449
|
+
join_clauses = [join.definition() for join in self.main_part.joins]
|
450
|
+
final_cte += "\n" + ("\n".join(join_clauses))
|
451
|
+
final_cte += ")"
|
452
|
+
|
440
453
|
ctes.append(final_cte)
|
441
454
|
all_ctes = "\n,".join(ctes)
|
442
|
-
main_columns:List[SnowflakeViewColumn] =
|
443
|
-
self.main_part.join_columns())
|
455
|
+
main_columns:List[SnowflakeViewColumn] = self.main_part.columns
|
444
456
|
column_clauses = [f"\"OMNATA_FINAL_CTE\"."+c.original_to_transformed()
|
445
457
|
for c in main_columns]
|
446
458
|
|
447
459
|
view_body = f"""with {all_ctes}
|
448
460
|
select {', '.join(column_clauses)}
|
449
461
|
from OMNATA_FINAL_CTE """
|
450
|
-
|
451
|
-
join_clauses = [join.definition() for join in self.main_part.joins]
|
452
|
-
view_body += "\n" + ("\n".join(join_clauses))
|
462
|
+
|
453
463
|
return view_body
|
454
464
|
|
455
465
|
@classmethod
|
@@ -662,7 +672,15 @@ def normalized_view_part(
|
|
662
672
|
if json_schema.joins:
|
663
673
|
joins = json_schema.joins
|
664
674
|
comment = json_schema.description
|
665
|
-
|
675
|
+
|
676
|
+
direct_view_columns = [c for c in view_columns if c.is_join_column]
|
677
|
+
join_view_columns = [c for c in view_columns if not c.is_join_column]
|
678
|
+
# The final order of view columns is:
|
679
|
+
#- APP_IDENTIFIER
|
680
|
+
#- Direct and joined columns, ordered so that columns that reference other columns are defined after the columns they reference
|
681
|
+
#- OMNATA_RETRIEVE_DATE, OMNATA_RAW_RECORD, OMNATA_IS_DELETED, OMNATA_RUN_ID
|
682
|
+
view_columns = SnowflakeViewColumn.order_by_reference(direct_view_columns +
|
683
|
+
join_view_columns)
|
666
684
|
return SnowflakeViewPart(
|
667
685
|
stream_name=stream_name,
|
668
686
|
raw_table_location=raw_table_location,
|
File without changes
|
File without changes
|
File without changes
|
{omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/api.py
RENAMED
File without changes
|
{omnata_plugin_runtime-0.10.6a246 → omnata_plugin_runtime-0.10.7}/src/omnata_plugin_runtime/forms.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|