Skip to content

SNOW-2912540: translate create_temp_table=True to table_type in AST encoding - #4296

Closed
sfc-gh-fpawlowski wants to merge 2 commits into
ud-local-test-scriptsfrom
worktree-create-temp-table-ast-fix
Closed

SNOW-2912540: translate create_temp_table=True to table_type in AST encoding#4296
sfc-gh-fpawlowski wants to merge 2 commits into
ud-local-test-scriptsfrom
worktree-create-temp-table-ast-fix

Conversation

@sfc-gh-fpawlowski

Copy link
Copy Markdown

Summary

Extends #4282 by fixing an AST encoding inconsistency: when a caller passes the deprecated create_temp_table=True parameter, the Python runtime correctly translates it to table_type="temporary", but the AST proto was still recording create_temp_table=True as a separate boolean field — forcing the server-side AST decoder to handle two representations for the same thing.

Changes:

  • dataframe_writer.py: Move create_temp_table deprecation coercion to before the AST emission block in save_as_table, so table_type is already resolved when WriteTable is encoded. Remove expr.create_temp_table emission.
  • session.py: Remove ast.create_temp_table = create_temp_table from the write_pandas AST block — the coercion already fires before AST emission there, so ast.table_type carries the correct value.
  • dataframe.py: Replace create_temp_table=True with table_type="temp" in the internal cache_result mock path, matching the real code path and avoiding a spurious deprecation warning from internal code.
  • ast.proto: Mark both create_temp_table fields as // Deprecated: use table_type instead. (fields retained for wire compatibility).
  • tests/ast/data/session_write_pandas.test: Remove create_temp_table: true from expected encoded AST and create_temp_table=True from expected unparser output.

Test plan

  • tests/integ/test_dataframe.py deprecation-warning test (~line 5371) — warning still fires, table_type still resolves correctly
  • tests/integ/test_pandas_to_df.py deprecation-warning test (~line 385) — same
  • tests/ast/ golden file tests pass with updated session_write_pandas.test
  • cache_result mock path no longer emits a deprecation warning

🤖 Generated with Claude Code

sfc-gh-fpawlowski and others added 2 commits July 28, 2026 10:17
…ncoding

The deprecated `create_temp_table` parameter was being emitted to the
proto AST as a separate boolean field even though the runtime already
translates it to `table_type="temporary"`. This meant the AST decoder
had to handle two representations for the same thing.

Fix: move the deprecation coercion before the AST block in save_as_table
so `table_type` is already resolved when emitted; remove the deprecated
field from both AST emission sites (WriteTable and WritePandas); update
the internal cache_result mock path to pass table_type="temp" directly;
mark the proto fields as deprecated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…_table removal

Remove create_temp_table from the expected encoded AST and unparser
output in the write_pandas golden test — the field is no longer emitted
to the proto since the deprecation coercion now happens before the AST
block, making table_type the sole carrier of this information.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.25%. Comparing base (c46a533) to head (a7f2c2f).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           ud-local-test-scripts    #4296       +/-   ##
==========================================================
- Coverage                  95.20%   54.25%   -40.96%     
==========================================================
  Files                        171      170        -1     
  Lines                      44463    44061      -402     
  Branches                    7606     7534       -72     
==========================================================
- Hits                       42331    23904    -18427     
- Misses                      1320    19069    +17749     
- Partials                     812     1088      +276     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sfc-gh-fpawlowski
sfc-gh-fpawlowski marked this pull request as ready for review July 28, 2026 16:36
@sfc-gh-fpawlowski
sfc-gh-fpawlowski requested review from a team as code owners July 28, 2026 16:36
@sfc-gh-fpawlowski
sfc-gh-fpawlowski requested review from sfc-gh-mayliu, sfc-gh-yixie and sfc-gh-yuwang and removed request for a team July 28, 2026 16:36

@snowflake-security-bot snowflake-security-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Snowflake Security Review

Security grade: A — Passed

No security findings after adjudication. This PR passes the Snowflake Security Review.

📊 4 of 5 files (1 test skipped) · 16,694 lines reviewed · 2 candidates → 0 kept · retrieval: on

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants