SIENTIAPDE-1273
Refactor data export in Drift, SimpleMetrics, and FormatAndExportPrediction workflows to improve data handling. Changed the export format from a list of dictionaries to direct objects for enhanced clarity and compatibility with downstream systems.
This commit is contained in:
@@ -52,6 +52,7 @@ class Drift:
|
|||||||
**metadata,
|
**metadata,
|
||||||
'query': gathering_query,
|
'query': gathering_query,
|
||||||
'datetime_columns': ['timestamp', 'created_at'],
|
'datetime_columns': ['timestamp', 'created_at'],
|
||||||
|
'orient': 'records',
|
||||||
},
|
},
|
||||||
retry_policy=retry_policy,
|
retry_policy=retry_policy,
|
||||||
start_to_close_timeout=timedelta(seconds=300),
|
start_to_close_timeout=timedelta(seconds=300),
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class SimpleMetrics:
|
|||||||
**metadata,
|
**metadata,
|
||||||
'query': query,
|
'query': query,
|
||||||
'datetime_columns': ['timestamp'],
|
'datetime_columns': ['timestamp'],
|
||||||
|
'orient': 'records',
|
||||||
},
|
},
|
||||||
retry_policy=retry_policy,
|
retry_policy=retry_policy,
|
||||||
start_to_close_timeout=timedelta(seconds=300),
|
start_to_close_timeout=timedelta(seconds=300),
|
||||||
@@ -82,7 +83,7 @@ class SimpleMetrics:
|
|||||||
Activities.export_data_to_postgres,
|
Activities.export_data_to_postgres,
|
||||||
{
|
{
|
||||||
**metadata,
|
**metadata,
|
||||||
'data': simple_metrics.to_dict(orient='records'),
|
'data': simple_metrics,
|
||||||
'schema': input_data['schema'],
|
'schema': input_data['schema'],
|
||||||
'table_name': input_data['target_table_name'],
|
'table_name': input_data['target_table_name'],
|
||||||
'timestamp_conversion': {
|
'timestamp_conversion': {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class FormatAndExportPrediction:
|
|||||||
**metadata,
|
**metadata,
|
||||||
'schema': input_data['schema'],
|
'schema': input_data['schema'],
|
||||||
'table_name': input_data['transform_table_name'],
|
'table_name': input_data['transform_table_name'],
|
||||||
'data': transformed.to_dict(orient='records'),
|
'data': transformed,
|
||||||
'timestamp_conversion': {
|
'timestamp_conversion': {
|
||||||
'column': 'timestamp',
|
'column': 'timestamp',
|
||||||
'format': DATETIME_FORMAT_WITH_TZ,
|
'format': DATETIME_FORMAT_WITH_TZ,
|
||||||
@@ -156,7 +156,7 @@ class FormatAndExportPrediction:
|
|||||||
**metadata,
|
**metadata,
|
||||||
'schema': input_data['schema'],
|
'schema': input_data['schema'],
|
||||||
'table_name': input_data['table_name'],
|
'table_name': input_data['table_name'],
|
||||||
'data': prediction.to_dict(orient='records'),
|
'data': prediction,
|
||||||
'timestamp_conversion': {'column': 'timestamp', 'format': DATETIME_FORMAT_WITH_TZ},
|
'timestamp_conversion': {'column': 'timestamp', 'format': DATETIME_FORMAT_WITH_TZ},
|
||||||
},
|
},
|
||||||
retry_policy=retry_policy,
|
retry_policy=retry_policy,
|
||||||
|
|||||||
Reference in New Issue
Block a user