Skip to content

SNOW-2912540: remap write_pandas missing-table errors via ProgrammingError.raw_msg - #4328

Open
sfc-gh-fpawlowski wants to merge 1 commit into
SNOW-2912540-mock-ud-connect-hookfrom
SNOW-2912540-write-pandas-raw-msg
Open

SNOW-2912540: remap write_pandas missing-table errors via ProgrammingError.raw_msg#4328
sfc-gh-fpawlowski wants to merge 1 commit into
SNOW-2912540-mock-ud-connect-hookfrom
SNOW-2912540-write-pandas-raw-msg

Conversation

@sfc-gh-fpawlowski

Copy link
Copy Markdown

Summary

  • Session.write_pandas remapped a missing table only when ProgrammingError.msg ended with "does not exist".
  • Universal Driver suffixes .msg with (request_id=..., sfqid=...), so the remap never fired and raw 001757 leaked.
  • Check getattr(pe, "raw_msg", pe.msg) instead — both v4 and v5 store the unformatted body there.

Context

Stacked on #4326. Recovers test_write_pandas / test_write_pandas_with_overwrite on UD (CI run 32475873257, 9 unique tests / 18 grouped failures).

Test plan

  • tests/integ/test_pandas_to_df.py::test_write_pandas
  • tests/integ/test_pandas_to_df.py::test_write_pandas_with_overwrite
  • Confirm legacy connector still remaps (.raw_msg / .msg both end with "does not exist").

Made with Cursor

…Error.raw_msg

Co-authored-by: Cursor <cursoragent@cursor.com>
@sfc-gh-fpawlowski
sfc-gh-fpawlowski force-pushed the SNOW-2912540-write-pandas-raw-msg branch from 1fddef5 to 0c1595c Compare August 23, 2026 22:52
@sfc-gh-fpawlowski
sfc-gh-fpawlowski marked this pull request as ready for review August 24, 2026 12:19
@sfc-gh-fpawlowski
sfc-gh-fpawlowski requested a review from a team as a code owner August 24, 2026 12:19
@sfc-gh-fpawlowski
sfc-gh-fpawlowski requested review from sfc-gh-aling, sfc-gh-bkogan and sfc-gh-yixie and removed request for a team August 24, 2026 12:19
Comment on lines +3631 to +3632
msg = getattr(pe, "raw_msg", pe.msg)
if msg.endswith("does not exist"):

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.

Potential AttributeError if raw_msg attribute exists but is None. The getattr function only returns the default value when the attribute doesn't exist, not when it exists with a None value. If pe.raw_msg is None, line 3632 will call None.endswith() and crash.

Fix:

msg = getattr(pe, "raw_msg", None) or pe.msg
if msg.endswith("does not exist"):

Or add a null check:

msg = getattr(pe, "raw_msg", pe.msg)
if msg and msg.endswith("does not exist"):
Suggested change
msg = getattr(pe, "raw_msg", pe.msg)
if msg.endswith("does not exist"):
msg = getattr(pe, "raw_msg", None) or pe.msg
if msg.endswith("does not exist"):

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@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

This PR was classified as LOW risk by the automated pre-screen.

@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

This PR was classified as LOW risk by the automated pre-screen.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant