From 0ce70b974545176925ab53d6282cebb8df6177e9 Mon Sep 17 00:00:00 2001 From: Qinyi Ding Date: Tue, 29 Sep 2026 23:22:07 -0700 Subject: [PATCH] [DOC-11570] Explain session-stage references and lifetime Clarify existing API behavior without changing executable code. Generated with [Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) Co-authored-by: Snowflake CoCo --- src/snowflake/snowpark/session.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/snowflake/snowpark/session.py b/src/snowflake/snowpark/session.py index a6448b59af..68d376e1b7 100644 --- a/src/snowflake/snowpark/session.py +++ b/src/snowflake/snowpark/session.py @@ -3269,6 +3269,24 @@ def get_session_stage( These artifacts include libraries and packages for UDFs that you define in this session via :func:`add_import`. + The return value is a Snowflake stage reference beginning with ``@``, + not a local directory or the contents of a file. Pass it to file + operations such as :meth:`FileOperation.put` to upload artifacts to + Snowflake. Treat this session-scoped temporary storage as disposable, + not as a permanent location for application data. + + Example:: + + >>> stage = session.get_session_stage() # doctest: +SKIP + >>> stage.startswith("@") # doctest: +SKIP + True + >>> session.get_session_stage() == stage # doctest: +SKIP + True + + The stage name is generated by Snowpark, so don't hardcode the name + returned by another session. The first call can create a temporary + stage in Snowflake and requires a connection with appropriate privileges. + Note: This temporary stage is created once under the current database and schema of a Snowpark session. Therefore, if you switch database or schema during the session, the stage will not be re-created