|
6 | 6 | import sys |
7 | 7 | import typing as t |
8 | 8 | import shutil |
9 | | -from datetime import datetime, timedelta |
| 9 | +from datetime import date, datetime, timedelta |
10 | 10 | from unittest.mock import patch |
11 | 11 | import numpy as np # noqa: TID253 |
12 | 12 | import pandas as pd # noqa: TID253 |
13 | 13 | import pytest |
14 | 14 | import pytz |
| 15 | +import time_machine |
15 | 16 | from sqlglot import exp, parse_one |
16 | 17 | from sqlglot.optimizer.normalize_identifiers import normalize_identifiers |
17 | 18 | from sqlglot.optimizer.qualify_columns import quote_identifiers |
@@ -2429,6 +2430,24 @@ def capture_execution_stats( |
2429 | 2430 | assert actual_execution_stats["incremental_model"].total_bytes_processed |
2430 | 2431 | assert actual_execution_stats["full_model"].total_bytes_processed |
2431 | 2432 |
|
| 2433 | + # run that loads 0 rows in incremental model |
| 2434 | + with patch.object( |
| 2435 | + context.console, "update_snapshot_evaluation_progress", capture_execution_stats |
| 2436 | + ): |
| 2437 | + with time_machine.travel(date.today() + timedelta(days=1)): |
| 2438 | + context.run() |
| 2439 | + |
| 2440 | + if ctx.engine_adapter.SUPPORTS_QUERY_EXECUTION_TRACKING: |
| 2441 | + assert actual_execution_stats["incremental_model"].total_rows_processed == 0 |
| 2442 | + # snowflake doesn't track rows for CTAS |
| 2443 | + assert actual_execution_stats["full_model"].total_rows_processed == ( |
| 2444 | + None if ctx.mark.startswith("snowflake") else 3 |
| 2445 | + ) |
| 2446 | + |
| 2447 | + if ctx.mark.startswith("bigquery"): |
| 2448 | + assert actual_execution_stats["incremental_model"].total_bytes_processed |
| 2449 | + assert actual_execution_stats["full_model"].total_bytes_processed |
| 2450 | + |
2432 | 2451 | # make and validate unmodified dev environment |
2433 | 2452 | no_change_plan: Plan = context.plan_builder( |
2434 | 2453 | environment="test_dev", |
|
0 commit comments