fix: Temporal filter conversion in viz migrations (#33224)

This commit is contained in:
Michael S. Molina
2025-05-02 08:27:49 -03:00
committed by GitHub
parent 17d7b72f3b
commit 6db3a4d9d2
2 changed files with 33 additions and 11 deletions

View File

@@ -21,7 +21,7 @@ from tests.unit_tests.migrations.viz.utils import migrate_and_assert
SOURCE_FORM_DATA: dict[str, Any] = {
"granularity_sqla": "ds",
"time_range": "100 years ago : now",
"time_range": "100 years ago : today",
"viz_type": "pivot_table",
}
@@ -29,7 +29,7 @@ TARGET_FORM_DATA: dict[str, Any] = {
"form_data_bak": SOURCE_FORM_DATA,
"granularity_sqla": "ds",
"rowOrder": "value_z_to_a",
"time_range": "100 years ago : now",
"time_range": "100 years ago : today",
"viz_type": "pivot_table_v2",
}
@@ -40,7 +40,7 @@ def test_migration() -> None:
target["adhoc_filters"] = [
{
"clause": "WHERE",
"comparator": "100 years ago : now",
"comparator": "100 years ago : today",
"expressionType": "SIMPLE",
"operator": "TEMPORAL_RANGE",
"subject": "ds",
@@ -65,7 +65,9 @@ def test_custom_sql_time_column() -> None:
"comparator": None,
"expressionType": "SQL",
"operator": "TEMPORAL_RANGE",
"sqlExpression": "sum(ds)",
"sqlExpression": (
"sum(ds) >= '1925-04-24T00:00:00' AND sum(ds) < '2025-04-24T00:00:00'"
),
"subject": "ds",
}
]