You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing SQL conversion to always use pretty=True (#248)
This drastically increases the readability of the generated SQL text when debugging, especially when errors are caused during runtime execution of the query without a clear cause unless you look at the generated SQL text. Since this changed a lot of tests, also moved all of the SQL generation tests to SQL files in a folder that either get read or written to depending on the same environment variable as planner tests.
), "Mismatch between tree generated SQL text and expected SQL text"
74
81
75
82
76
83
@pytest.mark.parametrize(
77
-
"pydough_code,expected_sql,graph_name",
84
+
"pydough_code,test_name,graph_name",
78
85
[
79
86
pytest.param(
80
87
hour_minute_day,
81
-
"""SELECT transaction_id, _expr0, _expr1, _expr2 FROM (SELECT transaction_id AS ordering_0, _expr0, _expr1, _expr2, transaction_id FROM (SELECT _expr0, _expr1, _expr2, symbol, transaction_id FROM (SELECT EXTRACT(HOUR FROM date_time) AS _expr0, EXTRACT(MINUTE FROM date_time) AS _expr1, EXTRACT(SECOND FROM date_time) AS _expr2, ticker_id, transaction_id FROM (SELECT sbTxDateTime AS date_time, sbTxId AS transaction_id, sbTxTickerId AS ticker_id FROM main.sbTransaction)) LEFT JOIN (SELECT sbTickerId AS _id, sbTickerSymbol AS symbol FROM main.sbTicker) ON ticker_id = _id) WHERE symbol IN ('AAPL', 'GOOGL', 'NFLX')) ORDER BY ordering_0""",
88
+
"hour_minute_day",
82
89
"Broker",
83
90
id="hour_minute_day",
84
91
),
85
92
],
86
93
)
87
94
deftest_pydough_to_sql_defog(
88
95
pydough_code: Callable[[], UnqualifiedNode],
89
-
expected_sql: str,
96
+
test_name: str,
90
97
graph_name: str,
91
98
defog_graphs: graph_fetcher,
99
+
get_sql_test_filename: Callable[[str], str],
100
+
update_tests: bool,
92
101
) ->None:
93
102
"""
94
103
Tests that a PyDough unqualified node can be correctly translated to its
0 commit comments