Skip to content

Name the Snowflake sessions the client opens - #54

Open
Manushpm8 wants to merge 2 commits into
mainfrom
name-snowflake-sessions
Open

Manushpm8 wants to merge 2 commits into
mainfrom
name-snowflake-sessions

Conversation

@Manushpm8

Copy link
Copy Markdown
Collaborator

Summary

Snowflake attributes a session's queries by the application the session names at login. Sessions the client opened named none, so they showed up as the driver's default.

Each Snowflake session the client opens now names itself nvidia/kumo-sdm when nothing else names it.

This was reviewed as #50, which merged into #51's branch rather than main. #51 has reverted it, and it lands here on its own, with one fix from review since.

  • The name is added after the driver resolves the connection. _NamedConnection subclasses the driver's SnowflakeConnection and adds application in connect. The driver first calls connect once it has merged three things:
    • the caller's arguments;
    • the connections.toml profile, read from the caller's connections_file_path if one is given;
    • its own detection of SF_PARTNER, Streamlit, Jupyter and Snowflake notebooks.
  • Any other name is kept. That includes an application argument, one in the profile, SF_PARTNER, or one of the driver's notebook tags.
  • Fixed since Name the Snowflake sessions the client opens #50: with no arguments, or only connections_file_path, the driver replaces what it was given with the default connection's parameters, which drops the name it had just detected. The session was then named nvidia/kumo-sdm under Streamlit or SF_PARTNER. _NamedConnection now asks the driver's detection again before using its own name (e6e8992).
  • Everything else is the driver's own. The client does not read the driver's config or choose its default connection. The connections file, the default connection and the error when nothing is configured all behave as before.
  • Connections the caller owns are unchanged. A borrowed Snowpark session, or a connection the caller opens and passes to a source, is used as it is.

Tests

test_snowflake_names_a_session_only_where_nothing_else_does runs the driver's real resolution (snowflake-connector-python 4.8.0) over a real connections.toml, and stops at login. Its cases:

Session opened with Application sent
credentials nvidia/kumo-sdm
credentials and application='theirs' theirs
credentials, SF_PARTNER set the partner
credentials, Streamlit loaded streamlit
a profile that sets application the profile's
a profile that doesn't nvidia/kumo-sdm
only connections_file_path the default profile, and nvidia/kumo-sdm
only connections_file_path, SF_PARTNER set the default profile, and the partner
no arguments the default profile, and nvidia/kumo-sdm
no arguments, Streamlit loaded the default profile, and streamlit

What the cases catch:

Locally, the connectors suite passes (309 passed, 9 skipped), with ruff, ruff format, mypy and the hygiene check clean.

🤖 Generated with Claude Code

Manushpm8 and others added 2 commits October 26, 2026 13:21
A Snowflake session the client opens names itself nvidia/kumo-sdm when
nothing else names it, so Snowflake can attribute its queries. This was
reviewed as #50, which merged into another pull request's branch rather
than main; it lands here on its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Manush Murali <manushm@nvidia.com>
…tion

With no arguments, or only a connections file, the driver replaces what
it was given with the default connection's parameters, which drops the
SF_PARTNER or Streamlit name it had just detected. The session was then
named nvidia/kumo-sdm. The driver's detection is now asked again before
that name is used.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Manush Murali <manushm@nvidia.com>

This branch has not been deployed

No deployments
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.

2 participants