|
7 | 7 | import sys |
8 | 8 | import typing as t |
9 | 9 | import shutil |
10 | | -from datetime import datetime, timedelta |
| 10 | +from datetime import date, datetime, timedelta |
11 | 11 | from unittest.mock import patch |
12 | 12 | import numpy as np # noqa: TID253 |
13 | 13 | import pandas as pd # noqa: TID253 |
14 | 14 | import pytest |
15 | 15 | import pytz |
| 16 | +import time_machine |
16 | 17 | from sqlglot import exp, parse_one |
17 | 18 | from sqlglot.optimizer.normalize_identifiers import normalize_identifiers |
18 | 19 | from sqlglot.optimizer.qualify_columns import quote_identifiers |
@@ -2468,6 +2469,24 @@ def capture_execution_stats( |
2468 | 2469 | assert actual_execution_stats["incremental_model"].total_bytes_processed |
2469 | 2470 | assert actual_execution_stats["full_model"].total_bytes_processed |
2470 | 2471 |
|
| 2472 | + # run that loads 0 rows in incremental model |
| 2473 | + with patch.object( |
| 2474 | + context.console, "update_snapshot_evaluation_progress", capture_execution_stats |
| 2475 | + ): |
| 2476 | + with time_machine.travel(date.today() + timedelta(days=1)): |
| 2477 | + context.run() |
| 2478 | + |
| 2479 | + if ctx.engine_adapter.SUPPORTS_QUERY_EXECUTION_TRACKING: |
| 2480 | + assert actual_execution_stats["incremental_model"].total_rows_processed == 0 |
| 2481 | + # snowflake doesn't track rows for CTAS |
| 2482 | + assert actual_execution_stats["full_model"].total_rows_processed == ( |
| 2483 | + None if ctx.mark.startswith("snowflake") else 3 |
| 2484 | + ) |
| 2485 | + |
| 2486 | + if ctx.mark.startswith("bigquery"): |
| 2487 | + assert actual_execution_stats["incremental_model"].total_bytes_processed |
| 2488 | + assert actual_execution_stats["full_model"].total_bytes_processed |
| 2489 | + |
2471 | 2490 | # make and validate unmodified dev environment |
2472 | 2491 | no_change_plan: Plan = context.plan_builder( |
2473 | 2492 | environment="test_dev", |
|
0 commit comments