Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/bodosql_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to update version to use new pyproject Syntax and get rid of the warning message.


- name: Create virtual environment
# uv requires an existing virtual environment to install packages.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Build Wheels
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mysql_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
run: uv venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/oracle_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
run: uv venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgres_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
run: uv venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
uses: astral-sh/setup-uv@v3
with:
# Install a specific version of uv.
version: "0.4.23"
version: "0.6.0"

- name: Download TPCH DB
run: ./demos/setup_tpch.sh ./tpch.db
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/s3_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
run: uv venv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sf_masked_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
# See note in sf_testing.yml about why we use `uv venv` here.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sf_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.23"
version: "0.6.0"

- name: Create virtual environment
# uv requires an existing virtual environment to install packages.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies = ["pytz", "sqlglot==26.7.0", "pandas>=2.0.0", "jupyterlab", "pyarr
# TODO: Add homepage + documentation when docs are live.
Repository = "https://github.com/bodo-ai/PyDough"

[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"pre-commit",
"pytest",
"ruff==0.6.7",
Expand Down
16 changes: 15 additions & 1 deletion tests/test_pipeline_defog.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"""

from collections.abc import Callable
from contextlib import nullcontext
from unittest.mock import patch

import pandas as pd
import pytest

from pydough import init_pydough_context, to_sql
Expand Down Expand Up @@ -754,6 +757,10 @@ def test_graph_structure_defog(defog_graphs: graph_fetcher, graph_name: str) ->
defog_sql_text_dealership_adv8,
"dealership_adv8",
order_sensitive=True,
# Pin today so the generated VALUES clause (6 month-start
# timestamps) stays deterministic. Reference files reflect
# the Oct 2025 – Mar 2026 window (today = 2026-04-01).
fixed_today=pd.Timestamp("2026-04-01"),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This this would make the same 6 month range each time, wouldn't this be a problem next month for the expected result? Because defog_sql_text_dealership_adv8 changes every month (build dynamically) same with the defog data that uses current_date

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point of the PR. We are fixing the date to be the same for generating the exact same SQL files. It's not impacting the execution and the expected results of the query itself.

The key is that both sides of the comparison are now frozen to the same fixed point for SQL file tests only.
fixed_today patches pd.Timestamp.today() to always return 2026-04-01, so the generated SQL will always produce the Oct 2025–Mar 2026 window. The reference .sql files are hardcoded that same window. Since both sides are pinned to the same value, the test will pass every month.

The execution test (test_defog_e2e) is separate and unaffected. It uses SQL-native DATE('now', ...) expressions that compute relative to the actual current date, so it always queries the real current 6-month window from the live database.

),
id="dealership_adv8",
),
Expand Down Expand Up @@ -2032,7 +2039,14 @@ def test_defog_until_sql(
graph: GraphMetadata = get_dialect_defog_graphs(
empty_context_database.dialect, graph_name
)
unqualified: UnqualifiedNode = init_pydough_context(graph)(unqualified_impl)()
fixed_today = defog_pipeline_test_data.fixed_today
ctx = (
patch.object(pd.Timestamp, "today", return_value=fixed_today)
if fixed_today is not None
else nullcontext()
)
with ctx:
unqualified: UnqualifiedNode = init_pydough_context(graph)(unqualified_impl)()
sql_text: str = to_sql(
unqualified,
metadata=graph,
Expand Down
10 changes: 10 additions & 0 deletions tests/testing_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,16 @@ class PyDoughSQLComparisonTest:
same column names as in the reference solution.
"""

fixed_today: pd.Timestamp | None = None
"""
If set, ``pd.Timestamp.today`` is patched to return this value during
SQL generation in ``test_defog_until_sql``. Use this for queries that
call ``pd.Timestamp.today()`` internally (e.g. to build a date-range
dataframe), so the generated SQL stays deterministic and the reference
``.sql`` files never go stale. The execution test (``test_defog_e2e``)
is unaffected; it uses SQL-native ``DATE('now', ...)`` expressions.
"""

def run_e2e_test(
self,
fetcher: graph_fetcher,
Expand Down
Loading