omnata-plugin-runtime 0.11.3a319__tar.gz → 0.11.4a320__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.11.3a319 → omnata_plugin_runtime-0.11.4a320}/PKG-INFO +1 -1
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/pyproject.toml +1 -1
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/json_schema.py +48 -44
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/LICENSE +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/README.md +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/__init__.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/api.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/configuration.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/forms.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/logging.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/omnata_plugin.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/src/omnata_plugin_runtime/plugin_entrypoints.py +0 -0
- {omnata_plugin_runtime-0.11.3a319 → omnata_plugin_runtime-0.11.4a320}/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.11.
|
|
3
|
+
version = "0.11.4-a320"
|
|
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"
|
|
@@ -7,6 +7,7 @@ from typing import Any, Dict, Optional, Literal, List, Union, Tuple
|
|
|
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 graphlib import TopologicalSorter
|
|
10
11
|
from .logging import logger
|
|
11
12
|
|
|
12
13
|
class JsonSchemaProperty(BaseModel):
|
|
@@ -271,57 +272,60 @@ class SnowflakeViewColumn(BaseModel):
|
|
|
271
272
|
)
|
|
272
273
|
|
|
273
274
|
@classmethod
|
|
274
|
-
def order_by_reference(cls,current_stream_name:str,columns:List[Self]) -> List[Self]:
|
|
275
|
+
def order_by_reference(cls, current_stream_name: str, columns: List[Self]) -> List[Self]:
|
|
275
276
|
"""
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
277
|
+
Uses topological sorting to order columns so that if a column references another column,
|
|
278
|
+
the referenced column appears first in the list. This is required by Snowflake when
|
|
279
|
+
column expressions reference the alias of another column.
|
|
280
|
+
|
|
281
|
+
OMNATA_ system columns are always placed at the front of the result.
|
|
279
282
|
"""
|
|
280
283
|
logger.debug(
|
|
281
284
|
f"Ordering columns by reference for stream: {current_stream_name} ({len(columns)} columns)"
|
|
282
285
|
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
for column in columns[:]:
|
|
288
|
-
if column.original_name.startswith("OMNATA_"):
|
|
289
|
-
columns.remove(column)
|
|
290
|
-
omnata_system_columns_start.append(column)
|
|
291
|
-
|
|
286
|
+
|
|
287
|
+
# Separate OMNATA system columns - they always go first
|
|
288
|
+
omnata_system_columns = []
|
|
289
|
+
regular_columns = []
|
|
292
290
|
for column in columns:
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
291
|
+
if column.original_name.startswith("OMNATA_"):
|
|
292
|
+
omnata_system_columns.append(column)
|
|
293
|
+
else:
|
|
294
|
+
regular_columns.append(column)
|
|
295
|
+
|
|
296
|
+
# Build dependency graph: column_name -> list of columns it depends on
|
|
297
|
+
# (i.e., columns that must appear BEFORE it in the final order)
|
|
298
|
+
graph: Dict[str, List[str]] = {}
|
|
299
|
+
column_by_name: Dict[str, Self] = {}
|
|
300
|
+
|
|
301
|
+
for column in regular_columns:
|
|
302
|
+
column_by_name[column.original_name] = column
|
|
303
|
+
# Initialize with empty dependencies
|
|
304
|
+
graph[column.original_name] = []
|
|
305
|
+
|
|
306
|
+
# Add dependencies from referenced_columns
|
|
307
|
+
if column.referenced_columns:
|
|
308
|
+
referenced_in_current_stream = column.referenced_columns.get(current_stream_name, [])
|
|
309
|
+
for ref_col_name in referenced_in_current_stream:
|
|
310
|
+
# This column depends on ref_col_name, so ref_col_name must come first
|
|
311
|
+
graph[column.original_name].append(ref_col_name)
|
|
312
|
+
logger.debug(
|
|
313
|
+
f"Column {column.original_name} depends on {ref_col_name}"
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
# Use TopologicalSorter to sort the columns
|
|
317
|
+
try:
|
|
318
|
+
ts = TopologicalSorter(graph)
|
|
319
|
+
sorted_column_names = list(ts.static_order())
|
|
320
|
+
except ValueError as e:
|
|
321
|
+
# This would indicate a circular dependency
|
|
322
|
+
raise ValueError(f"Circular dependency detected in column references for stream {current_stream_name}: {e}")
|
|
323
|
+
|
|
324
|
+
# Reconstruct the column list in topological order
|
|
325
|
+
sorted_columns = [column_by_name[name] for name in sorted_column_names if name in column_by_name]
|
|
318
326
|
|
|
319
|
-
#
|
|
320
|
-
|
|
321
|
-
for column in columns_to_move_final:
|
|
322
|
-
columns.remove(column)
|
|
323
|
-
columns.insert(0, column)
|
|
324
|
-
return omnata_system_columns_start + columns
|
|
327
|
+
# Return OMNATA system columns first, followed by sorted regular columns
|
|
328
|
+
return omnata_system_columns + sorted_columns
|
|
325
329
|
|
|
326
330
|
|
|
327
331
|
class SnowflakeViewJoin(BaseModel):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|